Partager via


LiveEventTarget class

Receives events broadcast by an LiveEventSource.

Extends

LiveEventSource<TEvent>

Remarks

All live event targets are also sources. This simplifies the programming model for live event object by letting them create a single object thats capable of broadcasting events to other instances of itself.

Constructors

LiveEventTarget<TEvent>(LiveEventScope, string, LiveEventListener<TEvent>)

Creates a new LiveEventTarget instance.

Inherited Methods

sendEvent(TEvent)

Broadcasts an event to any listening LiveEventTarget instances.

sendLocalEvent(TEvent)

Same as SendEvent but only sent locally. Useful for events that do not need to be sent as a signal.

Constructor Details

LiveEventTarget<TEvent>(LiveEventScope, string, LiveEventListener<TEvent>)

Creates a new LiveEventTarget instance.

new LiveEventTarget(scope: LiveEventScope, eventName: string, listener: LiveEventListener<TEvent>)

Parameters

scope
LiveEventScope

Scope to use for sending events.

eventName

string

Name of the event to broadcast.

listener

LiveEventListener<TEvent>

Function to call when an event is sent or received.

Inherited Method Details

sendEvent(TEvent)

Broadcasts an event to any listening LiveEventTarget instances.

function sendEvent(evt: TEvent): Promise<ILiveEvent<TEvent>>

Parameters

evt

TEvent

Optional. Partial event object to send. The ILiveEvent.name, ILiveEvent.timestamp, and ILiveEvent.clientId fields will be automatically populated prior to sending.

Returns

Promise<ILiveEvent<TEvent>>

The full event, including ILiveEvent.name, ILiveEvent.timestamp, and ILiveEvent.clientId fields if known.

Inherited From LiveEventSource.sendEvent

sendLocalEvent(TEvent)

Same as SendEvent but only sent locally. Useful for events that do not need to be sent as a signal.

function sendLocalEvent(evt: TEvent): Promise<ILiveEvent<TEvent>>

Parameters

evt

TEvent

Optional. Partial event object. The ILiveEvent.name, ILiveEvent.timestamp, and ILiveEvent.clientId fields will be automatically populated.

Returns

Promise<ILiveEvent<TEvent>>

The full event, including ILiveEvent.name, ILiveEvent.timestamp, and ILiveEvent.clientId fields if known.

Inherited From LiveEventSource.sendLocalEvent