-
Notifications
You must be signed in to change notification settings - Fork 84
Translation for the page 'API Reference -> SyntheticEvent' #140
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,13 +6,13 @@ 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. | ||||||
Questa guida di riferimento documenta il contenitore `SyntheticEvent` che forma parte della sistema di React. Consulti la guida [Gestendo Eventi](/docs/handling-events.html) per imparare più. | ||||||
|
||||||
## Overview {#overview} | ||||||
## Panoramica {#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. | ||||||
Tuoi event handlers saranno passato istanze di `SyntheticEvent`, un cross-browser contenitore intorno all'evento nativo di browser. Lo ha stesso interfaccia come l'evento nativo di browser, compresi `stopPropagation()` e `preventDefault()`, eccetto gli eventi lavorano in modo identico in tutti browser. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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: | ||||||
Se constatati avere bisogno del evento di browser sottostante per qualche motivo, semplice usi il `nativeEvent` attributo lo portarti. Ogni `SyntheticEvent` oggetto ha gli seguente attributi: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
```javascript | ||||||
boolean bubbles | ||||||
|
@@ -31,15 +31,15 @@ number timeStamp | |||||
string type | ||||||
``` | ||||||
|
||||||
> Note: | ||||||
> Nota: | ||||||
> | ||||||
> 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. | ||||||
> A partire da v0.14, restituendo `false` da un event handler non più fermerà l'evento propagazione. Invece, `e.stopPropagation()` o `e.preventDefault()` dovrebbe essere scatenato manualmente, come appropriato. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### Event Pooling {#event-pooling} | ||||||
### Raggruppamento Eventi {#event-pooling} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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. | ||||||
Il `SyntheticEvent` è raggruppato. Questo significa che il `SyntheticEvent` oggetto sarà riusato e tutte proprietà sarà assegnando nullo dopo il callback dell'evento è stato invocato. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
Questo è per motivi di prestazione. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
Come tale, non puoi avere accesso all'evento in un modo asincrono. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
```javascript | ||||||
function onClick(event) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would translate the comments in the code below as well, Github doesn't allow me to suggest directly so here's some inspiration 😄 :
|
||||||
|
@@ -60,62 +60,62 @@ function onClick(event) { | |||||
} | ||||||
``` | ||||||
|
||||||
> Note: | ||||||
> Nota: | ||||||
> | ||||||
> 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. | ||||||
|
||||||
## Supported Events {#supported-events} | ||||||
|
||||||
React normalizes events so that they have consistent properties across different browsers. | ||||||
|
||||||
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. | ||||||
|
||||||
- [Clipboard Events](#clipboard-events) | ||||||
- [Composition Events](#composition-events) | ||||||
- [Keyboard Events](#keyboard-events) | ||||||
- [Focus Events](#focus-events) | ||||||
- [Form Events](#form-events) | ||||||
- [Mouse Events](#mouse-events) | ||||||
- [Pointer Events](#pointer-events) | ||||||
- [Selection Events](#selection-events) | ||||||
- [Touch Events](#touch-events) | ||||||
- [UI Events](#ui-events) | ||||||
- [Wheel Events](#wheel-events) | ||||||
- [Media Events](#media-events) | ||||||
- [Image Events](#image-events) | ||||||
- [Animation Events](#animation-events) | ||||||
- [Transition Events](#transition-events) | ||||||
- [Other Events](#other-events) | ||||||
> Se vuoi avere accesso le proprietà in un modo asincrono, dovresti invocare `event.persist()` sull'evento, quale rimuoverà l'evento sintetico dal pool e permettono riferimenti all'evento essere conservato da codice utente. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Eventi Supportati {#supported-events} | ||||||
|
||||||
React normalizza eventi così che hanno proprietà coerente in tutti browser. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
L'event handlers sotto sono scatenato da un event in la fase di gorgogliante. Per registrare un event handler per la fase di salvataggio, affiggi `Capture` al nome dell'evento; per esempio, invece di usando `onClick`, useresti `onClickCapture` per gestire l'evento della clicca nella fase salvataggia. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
- [Eventi degli Appunti](#clipboard-events) | ||||||
- [Eventi della Composizione](#composition-events) | ||||||
- [Eventi della Tastiera](#keyboard-events) | ||||||
- [Eventi di Focus](#focus-events) | ||||||
- [Eventi di Form](#form-events) | ||||||
- [Eventi del Mouse](#mouse-events) | ||||||
- [Eventi del Cursore](#pointer-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- [Eventi della Selezione](#selection-events) | ||||||
- [Eventi Tattile](#touch-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on its target, please |
||||||
- [Eventi della Interfaccia Utente](#ui-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on its target, please |
||||||
- [Eventi della Ruota](#wheel-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on its target, please |
||||||
- [Eventi degli Media](#media-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on its target, please |
||||||
- [Eventi della Immagine](#image-events) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on its target, please |
||||||
- [Eventi delle Animazioni](#animation-events) | ||||||
- [Eventi della Transizione](#transition-events) | ||||||
- [Altri Eventi](#other-events) | ||||||
|
||||||
* * * | ||||||
|
||||||
## Reference {#reference} | ||||||
## Riferimento {#reference} | ||||||
|
||||||
### Clipboard Events {#clipboard-events} | ||||||
### Eventi degli Appunti {#clipboard-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same correction below on each instance of it as well please |
||||||
|
||||||
``` | ||||||
onCopy onCut onPaste | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
DOMDataTransfer clipboardData | ||||||
``` | ||||||
|
||||||
* * * | ||||||
|
||||||
### Composition Events {#composition-events} | ||||||
### Eventi della Composizione {#composition-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onCompositionEnd onCompositionStart onCompositionUpdate | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
string data | ||||||
|
@@ -124,15 +124,15 @@ string data | |||||
|
||||||
* * * | ||||||
|
||||||
### Keyboard Events {#keyboard-events} | ||||||
### Eventi della Tastiera {#keyboard-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onKeyDown onKeyPress onKeyUp | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
boolean altKey | ||||||
|
@@ -149,53 +149,53 @@ 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). | ||||||
La `key` proprietà può accettare uno qualsiasi dei valori documentati nel [DOM Livello 3 Eventi specificazione](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* * * | ||||||
|
||||||
### Focus Events {#focus-events} | ||||||
### Eventi di Focus {#focus-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onFocus onBlur | ||||||
``` | ||||||
|
||||||
These focus events work on all elements in the React DOM, not just form elements. | ||||||
Questi eventi di focus lavorano su tutti elementi nel React Dom, non solo elementi di form. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
DOMEventTarget relatedTarget | ||||||
``` | ||||||
|
||||||
* * * | ||||||
|
||||||
### Form Events {#form-events} | ||||||
### Eventi di Form {#form-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onChange onInput onInvalid onSubmit | ||||||
``` | ||||||
|
||||||
For more information about the onChange event, see [Forms](/docs/forms.html). | ||||||
Per più informazioni For more information sul evento onChange, vedi [Forms](/docs/forms.html). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* * * | ||||||
|
||||||
### Mouse Events {#mouse-events} | ||||||
### Eventi del Mouse {#mouse-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
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. | ||||||
Il `onMouseEnter` e `onMouseLeave` eventi si propagano dal elemento essendo lasciato al uno essendo entrato invece il gorgogliante ordinario e non hanno una fase salvataggia. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
boolean altKey | ||||||
|
@@ -216,20 +216,20 @@ boolean shiftKey | |||||
|
||||||
* * * | ||||||
|
||||||
### Pointer Events {#pointer-events} | ||||||
### Eventi del Cursore {#pointer-events} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
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. | ||||||
Il `onPointerEnter` e `onPointerLeave` eventi si propagano dal elemento essendo lasciato al uno essendo entrato invece il gorgogliante ordinario e non hanno una fase salvataggia. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
As defined in the [W3 spec](https://www.w3.org/TR/pointerevents/), pointer events extend [Mouse Events](#mouse-events) with the following properties: | ||||||
Come definato nel [W3 specificazione](https://www.w3.org/TR/pointerevents/), eventi del cursore estendono [Eventi del Mouse](#mouse-events) con le seguente proprietà: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
```javascript | ||||||
number pointerId | ||||||
|
@@ -244,33 +244,33 @@ string pointerType | |||||
boolean isPrimary | ||||||
``` | ||||||
|
||||||
A note on cross-browser support: | ||||||
Una nota di cross-browser supporto: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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`. | ||||||
Eventi del cursore non sono ancora supportato in tutti browser (al tempo di scrittando questo articolo), browsers supportati includono: Chrome, Firefox, Edge, e Internet Explorer). React deliberatamente non polyfill supporto per altri browser perché un conforme-normale polyfill aumenterebbe il dimensione di carico di `react-dom` molto. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
If your application requires pointer events, we recommend adding a third party pointer event polyfill. | ||||||
Se tua applicazione desideri eventi del cursore, raccomandiamo aggiungiendo un cursore evento polyfill di terzo. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* * * | ||||||
|
||||||
### Selection Events {#selection-events} | ||||||
### Eventi della Selezione {#selection-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onSelect | ||||||
``` | ||||||
|
||||||
* * * | ||||||
|
||||||
### Touch Events {#touch-events} | ||||||
### Eventi Tattile {#touch-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onTouchCancel onTouchEnd onTouchMove onTouchStart | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
boolean altKey | ||||||
|
@@ -285,15 +285,15 @@ DOMTouchList touches | |||||
|
||||||
* * * | ||||||
|
||||||
### UI Events {#ui-events} | ||||||
### Eventi della Interfaccia Utente {#ui-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onScroll | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
number detail | ||||||
|
@@ -302,15 +302,15 @@ DOMAbstractView view | |||||
|
||||||
* * * | ||||||
|
||||||
### Wheel Events {#wheel-events} | ||||||
### Eventi della Ruota {#wheel-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onWheel | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
number deltaMode | ||||||
|
@@ -321,9 +321,9 @@ number deltaZ | |||||
|
||||||
* * * | ||||||
|
||||||
### Media Events {#media-events} | ||||||
### Eventi degli Media {#media-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted | ||||||
|
@@ -334,25 +334,25 @@ onTimeUpdate onVolumeChange onWaiting | |||||
|
||||||
* * * | ||||||
|
||||||
### Image Events {#image-events} | ||||||
### Eventi della Immagine {#image-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onLoad onError | ||||||
``` | ||||||
|
||||||
* * * | ||||||
|
||||||
### Animation Events {#animation-events} | ||||||
### Eventi delle Animazioni {#animation-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onAnimationStart onAnimationEnd onAnimationIteration | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
string animationName | ||||||
|
@@ -362,15 +362,15 @@ float elapsedTime | |||||
|
||||||
* * * | ||||||
|
||||||
### Transition Events {#transition-events} | ||||||
### Eventi della Transizione {#transition-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onTransitionEnd | ||||||
``` | ||||||
|
||||||
Properties: | ||||||
Proprietà: | ||||||
|
||||||
```javascript | ||||||
string propertyName | ||||||
|
@@ -380,9 +380,9 @@ float elapsedTime | |||||
|
||||||
* * * | ||||||
|
||||||
### Other Events {#other-events} | ||||||
### Altri Eventi {#other-events} | ||||||
|
||||||
Event names: | ||||||
Nomi dell'eventi: | ||||||
|
||||||
``` | ||||||
onToggle | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.