Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DomEvent

Hierarchy

  • DomEvent

Index

Methods

Static addListener

  • addListener(el: HTMLElement, type: string, fn: function, context?: any): DomEvent
  • Adds a listener fn to the element's DOM event of the specified type. this keyword inside the listener will point to context, or to the element if not specified.

    Parameters

    • el: HTMLElement
    • type: string
    • fn: function
        • (e: Event): void
        • Parameters

          • e: Event

          Returns void

    • Optional context: any

    Returns DomEvent

Static disableClickPropagation

  • disableClickPropagation(el: HTMLElement): DomEvent
  • Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown' and 'touchstart' events.

    Parameters

    • el: HTMLElement

    Returns DomEvent

Static getMousePosition

  • getMousePosition(e: Event, container?: HTMLElement): Point
  • Gets normalized mouse position from a DOM event relative to the container or to the whole page if not specified.

    Parameters

    • e: Event
    • Optional container: HTMLElement

    Returns Point

Static getWheelDelta

  • getWheelDelta(e: Event): number
  • Gets normalized wheel delta from a mousewheel DOM event.

    Parameters

    • e: Event

    Returns number

Static off

  • off(el: HTMLElement, type: string, fn: function, context?: any): DomEvent
  • Parameters

    • el: HTMLElement
    • type: string
    • fn: function
        • (e: Event): void
        • Parameters

          • e: Event

          Returns void

    • Optional context: any

    Returns DomEvent

Static on

  • on(el: HTMLElement, type: string, fn: function, context?: any): DomEvent
  • Parameters

    • el: HTMLElement
    • type: string
    • fn: function
        • (e: Event): void
        • Parameters

          • e: Event

          Returns void

    • Optional context: any

    Returns DomEvent

Static preventDefault

  • Prevents the default action of the event from happening (such as following a link in the href of the a element, or doing a POST request with page reload when form is submitted). Use it inside listener functions.

    Parameters

    • e: Event

    Returns DomEvent

Static removeListener

  • removeListener(el: HTMLElement, type: string, fn: function, context?: any): DomEvent
  • Removes an event listener from the element.

    Parameters

    • el: HTMLElement
    • type: string
    • fn: function
        • (e: Event): void
        • Parameters

          • e: Event

          Returns void

    • Optional context: any

    Returns DomEvent

Static stop

  • Does stopPropagation and preventDefault at the same time.

    Parameters

    • e: Event

    Returns DomEvent

Static stopPropagation

  • Stop the given event from propagation to parent elements. Used inside the listener functions: L.DomEvent.addListener(div, 'click', function (e) { L.DomEvent.stopPropagation(e); });

    Parameters

    • e: Event

    Returns DomEvent