Skip to main content

Event<TSource, TEventArgs> Class

The event object used for client-side events.

Declaration

export class Event<TSource, TEventArgs extends EventArgs>

Type Parameters

Name Description
TSource

The type of an event source.

TEventArgs EventArgs

The type of an event argument.

Inheritance

Event<TSource, TEventArgs>

Methods

addHandler(handler) Method

Dynamically connects the event with an appropriate event handler function.

Declaration

addHandler(
    handler: (s?: TSource,
    e?: TEventArgs) => void,
    executionContext?: TSource
): void

Parameters

Name Type Description
handler (s?: TSource, e?: TEventArgs) => void

The event handler function’s content.

executionContext TSource

The source.

clearHandlers Method

Dynamically disconnects the event from all the associated event handler functions.

Declaration

clearHandlers(): void

isEmpty Method

Gets whether the event handler is empty.

Declaration

isEmpty(): boolean

Returns

Type Description
boolean

true, if the event handler content is empty; otherwise, false

removeHandler(handler) Method

Dynamically disconnects the event from the associated event handler function.

Declaration

removeHandler(
    handler: (s?: TSource,
    e?: TEventArgs) => void,
    executionContext?: TSource
): void

Parameters

Name Type Description
handler (s?: TSource, e?: TEventArgs) => void

The event handler function’s content.

executionContext TSource

The source.