@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
51 lines (36 loc) • 3.05 kB
Markdown
---
lang: en
title: 'API docs: context.contextsubscriptionmanager'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.contextsubscriptionmanager.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [ContextSubscriptionManager](./context.contextsubscriptionmanager.md)
## ContextSubscriptionManager class
Manager for context observer subscriptions
<b>Signature:</b>
```typescript
export declare class ContextSubscriptionManager extends EventEmitter
```
<b>Extends:</b> EventEmitter
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(context)](./context.contextsubscriptionmanager._constructor_.md) | | Constructs a new instance of the <code>ContextSubscriptionManager</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [\_observers](./context.contextsubscriptionmanager._observers.md) | | Set<[ContextEventObserver](./context.contexteventobserver.md)<!-- -->> \| undefined | A list of registered context observers. The Set will be created when the first observer is added. |
| [\_parentContextEventListener?](./context.contextsubscriptionmanager._parentcontexteventlistener.md) | | [ContextEventListener](./context.contexteventlistener.md) | <i>(Optional)</i> A listener to watch parent context events |
| [context](./context.contextsubscriptionmanager.context.md) | | [Context](./context.context.md) | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [close()](./context.contextsubscriptionmanager.close.md) | | Close the context: clear observers, stop notifications, and remove event listeners from its parent context. |
| [isSubscribed(observer)](./context.contextsubscriptionmanager.issubscribed.md) | | Check if an observer is subscribed to this context |
| [notifyObservers(event, observers)](./context.contextsubscriptionmanager.notifyobservers.md) | | Publish an event to the registered observers. Please note the notification is queued and performed asynchronously so that we allow fluent APIs such as <code>ctx.bind('key').to(...).tag(...);</code> and give observers the fully populated binding. |
| [subscribe(observer)](./context.contextsubscriptionmanager.subscribe.md) | | Add a context event observer to the context |
| [unsubscribe(observer)](./context.contextsubscriptionmanager.unsubscribe.md) | | Remove the context event observer from the context |
| [waitUntilPendingNotificationsDone(timeout)](./context.contextsubscriptionmanager.waituntilpendingnotificationsdone.md) | | 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. |