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
Live |
Creates a new |
Inherited Methods
send |
Broadcasts an event to any listening |
send |
Same as |
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
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour