PointerWatcher listens for simple pointer actions like clicks, press and hold or hover.

Methods

Properties

Methods

Properties

offPointer: (
    target: EventTarget,
    startHandler: OnPointerHandler,
    endHandler?: OnPointerHandler,
) => void

Removes previously added handlers.

onPointer: (
    target: EventTarget,
    startHandler: OnPointerHandler,
    endHandler?: OnPointerHandler,
    options?: OnPointerOptions,
) => Promise<void>

Call the startHandler whenever the pointer action begins. Call the endHandler whenever the pointer action ends. If endHandler is not given, it defaults to startHandler.

For an explanation of what "begins" and "ends" means for each supported action, see OnPointerOptions.actions.

IMPORTANT: The same handlers can not be added multiple times for the same event target, even if the options differ. If the handler has already been added for this target, then it will be removed and re-added with the current options.