Skip to content

translate SyntheticEvent doc #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 12, 2019
142 changes: 70 additions & 72 deletions content/docs/reference-events.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
id: events
title: SyntheticEvent
title: 합성이벤트
permalink: docs/events.html
layout: docs
category: Reference
---

This reference guide documents the `SyntheticEvent` wrapper that forms part of React's Event System. See the [Handling Events](/docs/handling-events.html) guide to learn more.
이 참조는 리액트의 이벤트 시스템 일부를 구성하는 `합성이벤트` 래퍼를 설명합니다. 더 많은 정보는 [이벤트 처리](/docs/handling-events.html) 문서를 보세요.

## Overview {#overview}
## 개요 {#overview}

Your event handlers will be passed instances of `SyntheticEvent`, a cross-browser wrapper around the browser's native event. It has the same interface as the browser's native event, including `stopPropagation()` and `preventDefault()`, except the events work identically across all browsers.
이벤트 핸들러는 브라우저의 통합 브라우저 이벤트 래퍼 `합성이벤트` 객체를 전달받습니다. `stopPropagation()` `preventDefault()`를 포함해서 인터페이스는 브라우저의 원시 이벤트와 같지만 모든 브라우저에서 동일하게 동작합니다.

If you find that you need the underlying browser event for some reason, simply use the `nativeEvent` attribute to get it. Every `SyntheticEvent` object has the following attributes:
만약 브라우저의 기본 이벤트가 필요하다면 `nativeEvent` 어트리뷰트로 참조하세요. 모든 `합성이벤트` 객체는 다음 어트리뷰트들을 가집니다.

```javascript
boolean bubbles
Expand All @@ -31,15 +31,13 @@ number timeStamp
string type
```

> Note:
> 메모
>
> As of v0.14, returning `false` from an event handler will no longer stop event propagation. Instead, `e.stopPropagation()` or `e.preventDefault()` should be triggered manually, as appropriate.
> 0.14 버전부터 이벤트 핸들러가 `false`를 반환하더라도 이벤트 전파를 멈추지 않습니다. 대신 `e.stopPropagation()` 또는 `e.preventDefault()`를 필요할 때 호출하세요.

### Event Pooling {#event-pooling}
### 이벤트 풀링 {#event-pooling}

The `SyntheticEvent` is pooled. This means that the `SyntheticEvent` object will be reused and all properties will be nullified after the event callback has been invoked.
This is for performance reasons.
As such, you cannot access the event in an asynchronous way.
`합성이벤트`는 [풀링](https://en.wikipedia.org/wiki/Pool_(computer_science))됩니다. `합성이벤트` 객체는 재사용되고 모든 속성은 이벤트 핸들러가 호출된 다음 초기화됩니다. 성능적인 이유가 있습니다. 따라서 비동기적으로 이벤트 객체에 접근할 수 없습니다.

```javascript
function onClick(event) {
Expand All @@ -52,23 +50,23 @@ function onClick(event) {
console.log(eventType); // => "click"
}, 0);

// Won't work. this.state.clickEvent will only contain null values.
// 동작하지 않습니다. this.state.clickEvent 은 null만 가지게 될 것입니다.
this.setState({clickEvent: event});

// You can still export event properties.
// 이벤트 프로퍼티를 추출할 수 있습니다.
this.setState({eventType: event.type});
}
```

> Note:
> 메모
>
> If you want to access the event properties in an asynchronous way, you should call `event.persist()` on the event, which will remove the synthetic event from the pool and allow references to the event to be retained by user code.
> 비동기적으로 이벤트 속성을 참조하고 싶다면 이벤트 객체의 `event.persist()` 를 호출하세요. 합성 이벤트 풀에서 제거되고 사용자의 코드에서 참조가 가능해집니다.

## Supported Events {#supported-events}
## 지원 이벤트 목록 {#supported-events}

React normalizes events so that they have consistent properties across different browsers.
React는 이벤트들을 다른 브라우저에서도 같은 속성을 가지도록 표준화합니다.

The event handlers below are triggered by an event in the bubbling phase. To register an event handler for the capture phase, append `Capture` to the event name; for example, instead of using `onClick`, you would use `onClickCapture` to handle the click event in the capture phase.
다음 이벤트 핸들러들은 이벤트 버블링 단계에서 호출됩니다. 캡처 단계에서 이벤트 핸들러를 등록하기 위해서는 이벤트 이름에 `Capture`를 덧붙이세요. 예를 들어 `onClick` 대신 `onClickCapture`를 사용해서 캡처 단계에서 클릭 이벤트 핸들러를 사용할 수 있습니다.

- [Clipboard Events](#clipboard-events)
- [Composition Events](#composition-events)
Expand All @@ -89,33 +87,33 @@ The event handlers below are triggered by an event in the bubbling phase. To reg

* * *

## Reference {#reference}
## 참조 {#reference}

### Clipboard Events {#clipboard-events}
### 클립보드 이벤트 {#clipboard-events}

Event names:
이벤트 이름

```
onCopy onCut onPaste
```

Properties:
속성

```javascript
DOMDataTransfer clipboardData
```

* * *

### Composition Events {#composition-events}
### 합성 이벤트 {#composition-events}

Event names:
이벤트 이름

```
onCompositionEnd onCompositionStart onCompositionUpdate
```

Properties:
속성

```javascript
string data
Expand All @@ -124,15 +122,15 @@ string data

* * *

### Keyboard Events {#keyboard-events}
### 키보드 이벤트 {#keyboard-events}

Event names:
이벤트 이름

```
onKeyDown onKeyPress onKeyUp
```

Properties:
속성

```javascript
boolean altKey
Expand All @@ -149,57 +147,57 @@ boolean shiftKey
number which
```

The `key` property can take any of the values documented in the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values).
키 프로퍼티는 [DOM 3단계 이벤트 명세](https://www.w3.org/TR/uievents-key/#named-key-attribute-values)에 있는 어떤 값이든 가질 수 있습니다.

* * *

### Focus Events {#focus-events}
### 초점 이벤트 {#focus-events}

Event names:
이벤트 이름

```
onFocus onBlur
```

These focus events work on all elements in the React DOM, not just form elements.
초점 이벤트들은 form 요소 뿐만이 아니라 모든 React DOM 요소에 작동합니다.

Properties:
속성

```javascript
DOMEventTarget relatedTarget
```

* * *

### Form Events {#form-events}
### Form 이벤트 {#form-events}

Event names:
이벤트 이름

```
onChange onInput onInvalid onSubmit
```

For more information about the onChange event, see [Forms](/docs/forms.html).
onChange 이벤트에 대한 더 자세한 정보는 [Forms](/docs/forms.html)을 참조하세요.

* * *

### Mouse Events {#mouse-events}
### 마우스 이벤트 {#mouse-events}

Event names:
이벤트 이름

```
onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit
onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave
onMouseMove onMouseOut onMouseOver onMouseUp
```

The `onMouseEnter` and `onMouseLeave` events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.
`onMouseEnter` `onMouseLeave` 이벤트는 일반적인 버블링 대신 떠나는 요소에서 들어가는 요소로 전파되고 캡처 단계가 없습니다.

Properties:
속성

```javascript
boolean altKey
number button
number button
number buttons
number clientX
number clientY
Expand All @@ -216,20 +214,20 @@ boolean shiftKey

* * *

### Pointer Events {#pointer-events}
### 포인터 이벤트 {#pointer-events}

Event names:
이벤트 이름

```
onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture
onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut
```

The `onPointerEnter` and `onPointerLeave` events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.
`onPointerEnter` `onPointerLeave` 이벤트는 일반적인 버블링 대신 떠나는 요소에서 들어가는 요소로 전파되고 캡처 단계가 없습니다.

Properties:
속성

As defined in the [W3 spec](https://www.w3.org/TR/pointerevents/), pointer events extend [Mouse Events](#mouse-events) with the following properties:
[W3 명세](https://www.w3.org/TR/pointerevents/)에 정의된 대로 포인터 이벤트는 [마우스 이벤트](#mouse-events)와 다음 속성을 포함해 확장합니다.

```javascript
number pointerId
Expand All @@ -244,33 +242,33 @@ string pointerType
boolean isPrimary
```

A note on cross-browser support:
크로스 브라우저 지원에 대한 메모

Pointer events are not yet supported in every browser (at the time of writing this article, supported browsers include: Chrome, Firefox, Edge, and Internet Explorer). React deliberately does not polyfill support for other browsers because a standard-conform polyfill would significantly increase the bundle size of `react-dom`.
포인터 이벤트는 아직 모든 브라우저에서 지원되지 않습니다. (이 문서를 작성할 땐 Chrome, Firefox, Edge Internet Explorer가 지원함.) 표준 폴리필은 `react-dom`의 번들을 무겁게 만들기 때문에 React가 직접 브라우저 호환성을 위해 폴리필을 제공하진 않습니다.

If your application requires pointer events, we recommend adding a third party pointer event polyfill.
어플리케이션이 포인터 이벤트를 의존한다면 직접 서드 파티 포인터 폴리필을 추가하세요.

* * *

### Selection Events {#selection-events}
### 선택 이벤트 {#selection-events}

Event names:
이벤트 이름

```
onSelect
```

* * *

### Touch Events {#touch-events}
### 터치 이벤트 {#touch-events}

Event names:
이벤트 이름

```
onTouchCancel onTouchEnd onTouchMove onTouchStart
```

Properties:
속성

```javascript
boolean altKey
Expand All @@ -285,15 +283,15 @@ DOMTouchList touches

* * *

### UI Events {#ui-events}
### UI 이벤트 {#ui-events}

Event names:
이벤트 이름

```
onScroll
```

Properties:
속성

```javascript
number detail
Expand All @@ -302,15 +300,15 @@ DOMAbstractView view

* * *

### Wheel Events {#wheel-events}
### 휠 이벤트 {#wheel-events}

Event names:
이벤트 이름

```
onWheel
```

Properties:
속성

```javascript
number deltaMode
Expand All @@ -321,9 +319,9 @@ number deltaZ

* * *

### Media Events {#media-events}
### 미디어 이벤트 {#media-events}

Event names:
이벤트 이름

```
onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted
Expand All @@ -334,25 +332,25 @@ onTimeUpdate onVolumeChange onWaiting

* * *

### Image Events {#image-events}
### 이미지 이벤트 {#image-events}

Event names:
이벤트 이름

```
onLoad onError
```

* * *

### Animation Events {#animation-events}
### 애니메이션 이벤트 {#animation-events}

Event names:
이벤트 이름

```
onAnimationStart onAnimationEnd onAnimationIteration
```

Properties:
속성

```javascript
string animationName
Expand All @@ -362,15 +360,15 @@ float elapsedTime

* * *

### Transition Events {#transition-events}
### 트랜지션 이벤트 {#transition-events}

Event names:
이벤트 이름

```
onTransitionEnd
```

Properties:
속성

```javascript
string propertyName
Expand All @@ -380,9 +378,9 @@ float elapsedTime

* * *

### Other Events {#other-events}
### 기타 이벤트 {#other-events}

Event names:
이벤트 이름

```
onToggle
Expand Down