Page Contents
Home > @loopback/context > ContextSubscriptionManager
ContextSubscriptionManager class
Manager for context observer subscriptions
Signature:
export declare class ContextSubscriptionManager extends EventEmitter
Extends: EventEmitter
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(context) | Constructs a new instance of the ContextSubscriptionManager class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
_observers | Set<ContextEventObserver> | undefined | A list of registered context observers. The Set will be created when the first observer is added. | |
_parentContextEventListener? | ContextEventListener | (Optional) A listener to watch parent context events | |
context | Context |
Methods
Method | Modifiers | Description |
---|---|---|
close() | Close the context: clear observers, stop notifications, and remove event listeners from its parent context. | |
isSubscribed(observer) | Check if an observer is subscribed to this context | |
notifyObservers(event, observers) | Publish an event to the registered observers. Please note the notification is queued and performed asynchronously so that we allow fluent APIs such as ctx.bind('key').to(...).tag(...); and give observers the fully populated binding. |
|
subscribe(observer) | Add a context event observer to the context | |
unsubscribe(observer) | Remove the context event observer from the context | |
waitUntilPendingNotificationsDone(timeout) | Wait until observers are notified for all of currently pending notification events.This method is for test only to perform assertions after observers are notified for relevant events. |