@revideo/core / events / Subscribable
Class: Subscribable<TValue, THandler>
Defined in: events/EventDispatcherBase.ts:57
Provides safe access to the public interface of EventDispatcherBase.
Remarks
External classes can use it to subscribe to an event without being able to dispatch it.
Extended by
Type Parameters
TValue
TValue
The type of the argument passed to subscribers.
THandler
THandler extends EventHandler<TValue> = EventHandler<TValue>
The type of the callback function.
Constructors
Constructor
new Subscribable<
TValue,THandler>(dispatcher):Subscribable<TValue,THandler>
Defined in: events/EventDispatcherBase.ts:61
Parameters
dispatcher
EventDispatcherBase<TValue, THandler>
Returns
Subscribable<TValue, THandler>
Properties
dispatcher
protecteddispatcher:EventDispatcherBase<TValue,THandler>
Defined in: events/EventDispatcherBase.ts:62
Methods
subscribe()
subscribe(
handler): () =>void
Defined in: events/EventDispatcherBase.ts:72
Subscribe to the event.
Parameters
handler
THandler
The handler to invoke when the event occurs.
Returns
A callback function that cancels the subscription.
() => void
unsubscribe()
unsubscribe(
handler):void
Defined in: events/EventDispatcherBase.ts:81
Unsubscribe from the event.
Parameters
handler
THandler
The handler to unsubscribe.
Returns
void