Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Event<S, T>

Represents an event.

Events may have multiple listeners. Each listener is a function that gets invoked when the event is raised.

Event listeners are functions that take two parameters: sender is the object that raised the event, and args is an object that contains the event parameters.

Type parameters

Hierarchy

  • Event

Index

Constructors

constructor

  • new Event<S, T>(): Event<S, T>

Methods

addEventListener

  • Sets up a function that gets called whenever the event is raised.

    Parameters

    • listener: IEventListener<S, T>

      Function that gets called whenever the event is raised.

    • Optional self: any

      Value returned by the this keyword in the context of the listener function.

    Returns void

raise

  • raise(sender: S, args: T): void
  • Raises an Event, which causes all attached listeners to be invoked.

    Parameters

    • sender: S

      Object that raised the event.

    • args: T

      EventArgs object that contains the event parameters.

    Returns void

removeEventListener

  • removeEventListener(listener: IEventListener<S, T>, self?: any): void
  • Removes an event listener so it no longer gets called when the event is raised.

    Parameters

    • listener: IEventListener<S, T>

      Event listener to remove.

    • Optional self: any

      Value returned by the this keyword in the context of the listener function.

    Returns void

Generated using TypeDoc