Class Signal

Signal is a type of event bus. You can subscribe to events using add method and dispatch using sendN method where N is the number of arguments you wish to pass Signal is different from a normal event bus in that 1 signal corresponds to 1 event type. For example, in HTML you have addEventListener which lets you subscribe to any kind of event, let's use "mousedown" as a reference. Using a Signal you would instead have a signal corresponding to "mousedown" and dispatch this signal only for this event.

Example

`const mouseDown = new Signal<MouseEvent>(); mouseDown.send1(myMouseEvent);`

Constructors

  • Event dispatcher dedicated to single event type

    Returns Signal

Properties

handlers: any

Accessors

  • get dispatching(): boolean
  • Returns boolean

  • set dispatching(v): void
  • Parameters

    • v: boolean

    Returns void

    Deprecated

  • get silent(): boolean
  • Returns boolean

  • set silent(v): void
  • Parameters

    • v: boolean

    Returns void

Methods

  • Parameters

    • h: any
    • Optional context: any

    Returns (() => boolean)

      • (): boolean
      • Returns boolean

  • Parameters

    • h: any
    • Optional context: any

    Returns (() => boolean)

      • (): boolean
      • Returns boolean

  • Parameters

    • flag: any

    Returns void

  • Parameters

    • h: any

    Returns boolean

  • Parameters

    • Rest ...args: any[]

    Returns void

  • Parameters

    • flag: any

    Returns boolean

  • Tells if there are any handlers attached to the signal or not

    Returns boolean

  • Returns boolean

    Deprecated

    do not use

  • Parameters

    • other: any

    Returns Signal

    merged signal combining events from this and other

  • Returns void

  • Parameters

    • h: any
    • Optional thisArg: any

      if supplied, will match handlers with a specific context only

    Returns boolean

    true if a handler was removed, false otherwise

  • Remove all handlers

    Returns void

  • Parameters

    • flag: any

    Returns void

  • Returns void

  • Parameters

    • flag: any
    • value: any

    Returns void