Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventPropagator<Payloads, Events>

Class that attaches to EventListener and listens to its events only throughout its lifetime.

Type parameters

Hierarchy

Index

Constructors

constructor

  • Parameters

    • Default value doAttachSelf: boolean = true

      Whether the constructor should call the attachSelf function. If false, doAttachSelf should be called in constructor.

    Returns EventPropagator

Properties

Protected callbacks

callbacks: object

An array of callbacks per event name

Type declaration

  • [eventName: string]: function[]

debugEvents

debugEvents: boolean = false

Private watchedCallbacks

watchedCallbacks: Array<EventPropagatorCallback> = []

Methods

Protected Abstract attachSelf

Protected detach

  • detach(): void

dispatch

  • dispatch<T>(name: T, payload: Payloads[T]): void

dispose

  • dispose(): void
  • Dispose of all listeners. Should be called before the instance is garbage collected.

    Returns void

Protected doAttachSelf

  • doAttachSelf(): void
  • Function that calls the attachSelf function. Should be called in constructor.

    Returns void

off

on

once

Generated using TypeDoc