The PointerEvent()
constructor creates a new synthetic and untrusted PointerEvent
object instance.
event = new PointerEvent(type, PointerEventInit);
DOMString
representing the name of the event (see PointerEvent event types).PointerEventInit
dictionary, having the following fields: pointerId
— optional and defaulting to 0
, of type long
, that sets the value of the instance's PointerEvent.pointerId
.width
— optional and defaulting to 1
, of type double
, that sets the value of the instance's PointerEvent.width
.height
— optional and defaulting to 1
, of type double
, that sets the value of the instance's PointerEvent.height
.pressure
— optional and defaulting to 0
, of type float
, that sets the value of the instance's PointerEvent.pressure
.tangentialPressure
— optional and defaulting to 0
, of type float
, that sets the value of the instance's PointerEvent.tangentialPressure
.tiltX
— optional and defaulting to 0
, of type long
, that sets the value of the instance's PointerEvent.tiltX
.tiltY
— optional and defaulting to 0
, of type long
, that sets the value of the instance's PointerEvent.tiltY
.twist
— optional and defaulting to 0
, of type long
, that sets the value of the instance's PointerEvent.twist
.pointerType
— optional and defaulting to ""
, of type DOMString
, that sets the value of the instance's PointerEvent.pointerType
.isPrimary
— optional and defaulting to false
, of type Boolean
, that sets the value of the instance's PointerEvent.isPrimary
.Note: The PointerEventInit
dictionary also accepts fields from the MouseEvent
, UIEventInit
and EventInit
dictionaries.
var moveEvent = new PointerEvent("pointermove"); var downEvent = new PointerEvent("pointerdown", {pointerId: 1, bubbles: true, cancelable: true, pointerType: "touch", width: 100, height: 100, isPrimary: true });
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 55 | 12 | 59
|
11
|
42 | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 55 | 55 | 12 | No
|
42 | No | 6.0 |
© 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/PointerEvent/PointerEvent