Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventBlocker

Auxiliary class for blocking and unblocking events on a HTML element. Example for blocking the contextmenu:

blocker = new gloperate.EventBlocker(element);
blocker.block('contextmenu');

Hierarchy

  • EventBlocker

Index

Constructors

Properties

Methods

Constructors

constructor

  • new EventBlocker(element: HTMLElement, events?: string[]): EventBlocker
  • Creates an event blocker instance associated to a specific HTML element.

    Parameters

    • element: HTMLElement

      Element that is to be associated with this blocker for block und unblock.

    • Optional events: string[]

      Optional events that are blocked immediately.

    Returns EventBlocker

Properties

Private _blockListenerByEvent

_blockListenerByEvent: Map<string, HTMLEventListener> = ...

Lookup table for blocked events and their listener.

Protected _element

_element: HTMLElement

Element associated to this blocker.

Methods

block

  • block(eventIdentifier: string): void
  • Blocks a specific event by adding a listener the prevents the default and stops propagation.

    Parameters

    • eventIdentifier: string

      Event identifier that is to be blocked, e.g., 'contextmenu'.

    Returns void

unblock

  • unblock(eventIdentifier: string): void
  • Unblocks a previously blocked event by removing the blocker/listener.

    Parameters

    • eventIdentifier: string

      Event identifier that is to be unblocked, e.g., 'contextmenu'.

    Returns void