---
lang: en
title: 'API docs: context.contextsubscriptionmanager'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/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) &gt; [@loopback/context](./context.md) &gt; [ContextSubscriptionManager](./context.contextsubscriptionmanager.md)

## ContextSubscriptionManager class

Manager for context observer subscriptions

<b>Signature:</b>

```typescript
export declare class ContextSubscriptionManager extends 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) |  | <code>Set&lt;ContextEventObserver&gt; &#124; undefined</code> | A list of registered context observers. The Set will be created when the first observer is added. |
|  [\_parentContextEventListener](./context.contextsubscriptionmanager._parentcontexteventlistener.md) |  | <code>ContextEventListener</code> | A listener to watch parent context events |
|  [context](./context.contextsubscriptionmanager.context.md) |  | <code>Context</code> |  |

## 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. |


