Class Dom

Constructors

Properties

Methods

Constructors

Properties

controller: Controller<unknown>

Methods

  • Adds a DOM event listener that will get cleaned up when this component is cleaned up.

    Type Parameters

    Parameters

    • type: K

      Name of the DOM event to listen to

    • target: EventTarget

      Optional target to add the DOM listener to. If not provided, the target is document.

    • listener: ListenerFn<K>

      Listener to be called when the DOM event occurs

    • Optional useCapture: boolean

      Optional, defaults to false. If true, add the listener as a capturing listener.

    Returns void

  • Type Parameters

    Parameters

    Returns void

  • Adds a DOM event listener that will get cleaned up when this component is cleaned up.

    Type Parameters

    Parameters

    • type: K

      Name of the DOM event to listen to

    • target: EventTarget

      Optional target to add the DOM listener to. If not provided, the target is document.

    • listener: ListenerFn<K>

      Listener to be called when the DOM event occurs

    • Optional useCapture: boolean

      Optional, defaults to false. If true, add the listener as a capturing listener.

    Returns void

  • Type Parameters

    Parameters

    Returns void

  • Adds a one-time DOM event listener that will get cleaned up when this component is cleaned up.

    Type Parameters

    Parameters

    • type: K

      Name of the DOM event to listen to

    • target: EventTarget

      Optional target to add the DOM listener to. If not provided, the target is document.

    • listener: ListenerFn<K>

      Listener to be called when the DOM event occurs

    • Optional useCapture: boolean

      Optional, defaults to false. If true, add the listener as a capturing listener.

    Returns void

  • Type Parameters

    Parameters

    Returns void

  • Removes a DOM event listener that was added via #addListener, #on, or #once, using the same parameters as those methods.

    Type Parameters

    Parameters

    • type: K

      Name of the DOM event

    • target: EventTarget

      Optional target for the DOM listener. If not provided, the target is document.

    • listener: ListenerFn<K>

      Listener function that was passed to #addListener, #on, or #once.

    • Optional useCapture: boolean

      Optional, defaults to false. If true, removes a capturing listener.

    Returns void

  • Type Parameters

    Parameters

    Returns void