The TouchEvent()
constructor creates a new TouchEvent
.
event = new TouchEvent(typeArg, touchEventInit);
DOMString
representing the name of the event.EventInit
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 to false
, of type Boolean
, that indicates if the ctrl key was simultaneously pressed."shiftKey"
, optional and defaulting to false
, of type Boolean
, that indicates if the shift key was simultaneously pressed."altKey"
, optional and defaulting to false
, of type Boolean
, that indicates if the alt key was simultaneously pressed."metaKey"
, optional and defaulting to false
, of type Boolean
, that indicates if the meta key was simultaneously pressed.The TouchEventInit
dictionary also accepts fields from UIEventInit
and from EventInit
dictionaries.
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 48
|
? | ? | No | Yes | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 48
|
48
|
? | Yes | 12 | 3.2 | ? |
TouchEvent
, the interface of the objects it constructs.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent