---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md
  - https://yandex.ru/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/IEventController.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/jsapi-v2-1/doc/en/llms.txt

# IEventController

Interface for an event controller. For controlling how events are subscribed to and unsubscribed from on a particular event manager.

[Constructor](#constructor-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
IEventController()
```

## Methods {#methods-summary}

#|
|| **Name** | **Description** ||
|| [onStartListening](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStartListening)([events](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStartListening-param-events), [type](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStartListening-param-type)) | Called on the first subscription to the specified event type using the specified event manager. This method is optional. ||
|| [onStopListening](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStopListening)([events](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStopListening-param-events), [type](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventController.md#onStopListening-param-type)) | Called when a particular event type stops listening on the specified event manager (the last subscription is deleted). This method is optional.||
|#

## Methods details {#method_detail}

### onStartListening {#onStartListening}

```javascript
{} onStartListening(events, type)
```

Called on the first subscription to the specified event type using the specified event manager. This method is optional.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`events`](#onStartListening-param-events)[*](*star) | — | Type: [IEventManager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md)

Event manager. ||
|| [`type`](#onStartListening-param-type)[*](*star) | — | Type: String

Type of event. ||
|#

\* Mandatory parameter/option.

### onStopListening {#onStopListening}

```javascript
{} onStopListening(events, type)
```

Called when a particular event type stops listening on the specified event manager (the last subscription is deleted). This method is optional.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`events`](#onStopListening-param-events)[*](*star) | — | Type: [IEventManager](https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md)

Event manager. ||
|| [`type`](#onStopListening-param-type)[*](*star) | — | Type: String

Type of event. ||
|#

\* Mandatory parameter/option.

[*star]: Mandatory parameter/option.