Class: SubEvent<SenderType, DataType>
An implementation of SubEventInterface.
Type parameters
Name |
---|
SenderType |
DataType |
Implements
SubEventInterface
<SenderType
,DataType
>
Constructors
constructor
• new SubEvent<SenderType
, DataType
>(): SubEvent
<SenderType
, DataType
>
Type parameters
Name |
---|
SenderType |
DataType |
Returns
SubEvent
<SenderType
, DataType
>
Methods
clear
▸ clear(): void
Clears all subscriptions to this event.
Returns
void
Implementation of
Defined in
src/sdk/sub/SubEvent.ts:70
notify
▸ notify(sender
, data
): void
Emits an event to subscribers.
Parameters
Name | Type | Description |
---|---|---|
sender | SenderType | The source of the event. |
data | DataType | Data associated with the event. |
Returns
void
Implementation of
Defined in
src/sdk/sub/SubEvent.ts:83
off
▸ off(handler
): void
Unsubscribes a callback function from this event.
Parameters
Name | Type | Description |
---|---|---|
handler | (sender : SenderType , data : DataType ) => void | The 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
Defined in
src/sdk/sub/SubEvent.ts:64
on
▸ on(handler
, paused?
): Subscription
Subscribes to this event.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
handler | (sender : SenderType , data : DataType ) => void | undefined | A function to be called when an event is emitted. |
paused | boolean | false | Whether the new subscription should be initialized as paused. Defaults to false . |
Returns
The new subscription.
Implementation of
Defined in
src/sdk/sub/SubEvent.ts:52