The requested page is not available for the requested platform. You are viewing the content for Default platform.

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 event source.

TEventArgs

An object that provides data for an event.

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.

Optional Parameters

Name Type Default Description
executionContext TSource null

The source.

clearHandlers Method

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

Declaration

clearHandlers(): void

fireEvent(obj, args) Method

For internal use only.

Declaration

fireEvent(obj: TSource, args: TEventArgs): void

Parameters

Name Type Description
obj TSource
args TEventArgs

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.

Optional Parameters

Name Type Default Description
executionContext TSource null

The source.