Skip to main content

Class: SubEvent<SenderType, DataType>

Defined in: src/sdk/sub/SubEvent.ts:45

An implementation of SubEventInterface.

Type Parameters

Type Parameter
SenderType
DataType

Implements

Constructors

Constructor

new SubEvent<SenderType, DataType>(): SubEvent<SenderType, DataType>

Returns

SubEvent<SenderType, DataType>

Methods

clear()

clear(): void

Defined in: src/sdk/sub/SubEvent.ts:70

Clears all subscriptions to this event.

Returns

void

Implementation of

SubEventInterface.clear


notify()

notify(sender, data): void

Defined in: src/sdk/sub/SubEvent.ts:83

Emits an event to subscribers.

Parameters

ParameterTypeDescription
senderSenderTypeThe source of the event.
dataDataTypeData associated with the event.

Returns

void

Implementation of

SubEventInterface.notify


off()

off(handler): void

Defined in: src/sdk/sub/SubEvent.ts:64

Unsubscribes a callback function from this event.

Parameters

ParameterTypeDescription
handler(sender, data) => voidThe function to unsubscribe.

Returns

void

Deprecated

This method has been deprecated in favor of using the Subscription object returned by .on() to manage subscriptions.

Implementation of

SubEventInterface.off


on()

on(handler, paused): Subscription

Defined in: src/sdk/sub/SubEvent.ts:52

Subscribes to this event.

Parameters

ParameterTypeDefault valueDescription
handler(sender, data) => voidundefinedA function to be called when an event is emitted.
pausedbooleanfalseWhether the new subscription should be initialized as paused. Defaults to false.

Returns

Subscription

The new subscription.

Implementation of

SubEventInterface.on