Skip to main content

Class: Event<T>

components.Event

Simple event handler by Jason Kleban. Keep in mind that:

  • If you want to remove it later, you might want to declare the callback as an object.
  • If you want to maintain the reference to this, you will need to declare the callback as an arrow function.

Type parameters

Name
T

Properties

trigger

trigger: T extends void ? () => void : (data?: T) => void

Triggers all the callbacks assigned to this event.

Defined in

temp/components/base-types/base-types.ts:32

Methods

off

off(handler): void

Removes a callback from this event instance.

Parameters

NameTypeDescription
handlerT extends void ? () => void : (data: T) => voidthe callback to be removed from this event.

Returns

void

Defined in

temp/components/base-types/base-types.ts:25


on

on(handler): void

Add a callback to this event instance.

Parameters

NameTypeDescription
handlerT extends void ? () => void : (data: T) => voidthe callback to be added to this event.

Returns

void

Defined in

temp/components/base-types/base-types.ts:17


reset

reset(): void

Gets rid of all the suscribed events.

Returns

void

Defined in

temp/components/base-types/base-types.ts:42