---
lang: en
title: 'API docs: context.context.on'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.context.on.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Context](./context.context.md) &gt; [on](./context.context.on.md)

## Context.on() method

The "bind" event is emitted when a new binding is added to the context. The "unbind" event is emitted when an existing binding is removed.

<b>Signature:</b>

```typescript
on(eventName: 'bind' | 'unbind', listener: ContextEventListener): this;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  eventName | 'bind' \| 'unbind' | The name of the event - always <code>bind</code> or <code>unbind</code>. |
|  listener | [ContextEventListener](./context.contexteventlistener.md) | The listener function to call when the event is emitted. |

<b>Returns:</b>

this


