The TouchEvent()
constructor creates a new TouchEvent
.
Syntax
event = new TouchEvent(typeArg, touchEventInit);
Values
typeArg
Is a DOMString
representing the name of the event.
touchEventInit Optional
Is a TouchEventInit
dictionary, having the following fields:
"touches"
, optional and defaulting to [], of type Touch[], that is a list of objects for every point of contact currently touching the surface."targetTouches"
, optional and defaulting to [], of type Touch[], that is a list of objects for every point of contact that is touching the surface and started on the element that is the target of the current event."changedTouches"
, optional and defaulting to [], of type Touch[], that is a list of objects for every point of contact which contributed to the event."ctrlKey"
, optional and defaulting tofalse
, of typeBoolean
, that indicates if the ctrl key was simultaneously pressed."shiftKey"
, optional and defaulting tofalse
, of typeBoolean
, that indicates if the shift key was simultaneously pressed."altKey"
, optional and defaulting tofalse
, of typeBoolean
, that indicates if the alt key was simultaneously pressed."metaKey"
, optional and defaulting tofalse
, of typeBoolean
, that indicates if the meta key was simultaneously pressed.
The TouchEventInit
dictionary also accepts fields from UIEventInit
and from EventInit
dictionaries.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
TouchEvent() constructor
|
Chrome Full support 48 Full support 48 Notes' Chrome only supports the following |
Edge Full support ≤79 Full support ≤79 Notes' Edge only supports the following |
Firefox
? |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android Full support 48 Full support 48 Notes' Chrome only supports the following |
Chrome Android Full support 48 Full support 48 Notes' Chrome only supports the following |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support 3.2 |
Samsung Internet Android Full support 5.0 Full support 5.0 Notes' Samsung Internet only supports the following |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.'
- See implementation notes.
See also
TouchEvent
, the interface of the objects it constructs.
TouchEvent() by Mozilla Contributors is licensed under CC-BY-SA 2.5.