PointerEvent()

The PointerEvent() constructor creates a new synthetic and untrusted PointerEvent object instance.

Syntax

 event = new PointerEvent(type, PointerEventInit);

Arguments

type

Is a DOMString representing the name of the event (see PointerEvent event types).

PointerEventInitOptional

Is a PointerEventInit dictionary, having the following fields:

Note: The PointerEventInit dictionary also accepts fields from the MouseEvent, UIEventInit and EventInit dictionaries.

Example

var moveEvent = new PointerEvent("pointermove");

var downEvent = new PointerEvent("pointerdown",
   {pointerId: 1,
    bubbles: true,
    cancelable: true,
    pointerType: "touch",
    width: 100,
    height: 100,
    isPrimary: true
   });

Browser compatibility

BCD tables only load in the browser