---
title: "IEventEmitter"
---
# IEventEmitter

Defined in: [src/types/events.d.ts:20](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L20)

## Extends

- [`IDestructible`](./types.IDestructible.html)

### current

**current**: `string`

Defined in: [src/types/events.d.ts:35](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L35)

Get current event name

#### Example

```javascript
parent.e.on('openDialog closeDialog', function () {
    if (parent.e.current === 'closeDialog') {
        alert('Dialog was closed');
    } else {
        alert('Dialog was opened');
    }
});
```

***

### currents

**currents**: `string`[]

Defined in: [src/types/events.d.ts:36](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L36)

### mute()

**mute**(`event?`): `IEventEmitter`

Defined in: [src/types/events.d.ts:41](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L41)

Doesn't start any handler

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `event?` | `string` |

#### Returns

`IEventEmitter`

***

### isMuted()

**isMuted**(`event?`): `boolean`

Defined in: [src/types/events.d.ts:46](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L46)

No handlers are triggered for the event

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `event?` | `string` |

#### Returns

`boolean`

***

### unmute()

**unmute**(`event?`): `IEventEmitter`

Defined in: [src/types/events.d.ts:51](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L51)

Returns event handling

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `event?` | `string` |

#### Returns

`IEventEmitter`

***

#### Call Signature

**on**(`events`, `callback`, `options?`): `this`

Defined in: [src/types/events.d.ts:77](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L77)

Sets the handler for the specified event (Event List) for a given element .

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `events` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback` | [`CallbackFunction`](./types.CallbackFunction.html) |
| `options?` | [`IEventEmitterOnOptions`](./types.IEventEmitterOnOptions.html) |

##### Returns

`this`

##### Examples

```javascript
// set global handler
parent.on('beforeCommand', function (command) {
    alert('command');
});
```
*

```javascript
// set global handler
parent.on(document.body, 'click', function (e) {
    alert(this.href);
}, 'a');
```

#### Call Signature

**on**(`subject`, `events`, `callback`, `options?`): `this`

Defined in: [src/types/events.d.ts:83](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L83)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `subject` | [`CanArray`](../modules/types.html#canarray)\<`object` \| [`Window`](https://developer.mozilla.org/docs/Web/API/Window) \| [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)\> |
| `events` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback` | [`CallbackFunction`](./types.CallbackFunction.html) |
| `options?` | [`IEventEmitterOnOptions`](./types.IEventEmitterOnOptions.html) |

##### Returns

`this`

#### Call Signature

**on**(`object`, `event`, `callback`): `this`

Defined in: [src/types/events.d.ts:180](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L180)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `object` | [`Document`](https://developer.mozilla.org/docs/Web/API/Document) |
| `event` | `"selectionchange"` |
| `callback` | [`CallbackFunction`](./types.CallbackFunction.html) |

##### Returns

`this`

***

#### Call Signature

**one**(`events`, `callback`, `options?`): `this`

Defined in: [src/types/events.d.ts:90](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L90)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `events` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback` | [`CallbackFunction`](./types.CallbackFunction.html) |
| `options?` | [`IEventEmitterOnOptions`](./types.IEventEmitterOnOptions.html) |

##### Returns

`this`

#### Call Signature

**one**(`subject`, `events`, `callback`, `options?`): `this`

Defined in: [src/types/events.d.ts:96](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L96)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `subject` | [`CanArray`](../modules/types.html#canarray)\<`object` \| [`Window`](https://developer.mozilla.org/docs/Web/API/Window) \| [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)\> |
| `events` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback` | [`CallbackFunction`](./types.CallbackFunction.html) |
| `options?` | [`IEventEmitterOnOptions`](./types.IEventEmitterOnOptions.html) |

##### Returns

`this`

***

#### Call Signature

**off**(`events`, `callback?`): `IEventEmitter`

Defined in: [src/types/events.d.ts:129](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L129)

Disable all handlers specified event ( Event List ) for a given element. Either a specific event handler.

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `events` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback?` | [`CallbackFunction`](./types.CallbackFunction.html)\<`any`\> |

##### Returns

`IEventEmitter`

##### Example

```javascript
var a = {name: "Anton"};
parent.e.on(a, 'open', function () {
    alert(this.name);
});

parent.e.fire(a, 'open');
parent.e.off(a, 'open');
var b = {name: "Ivan"}, hndlr = function () {
 alert(this.name);
};
parent.e.on(b, 'open close', hndlr);
parent.e.fire(a, 'open');
parent.e.off(a, 'open', hndlr);
parent.e.fire(a, 'close');
parent.e.on('someGlobalEvents', function () {
  console.log(this); // parent
});
parent.e.fire('someGlobalEvents');
parent.e.off('someGlobalEvents');
```

#### Call Signature

**off**(`subjects`, `events?`, `callback?`): `IEventEmitter`

Defined in: [src/types/events.d.ts:131](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L131)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `subjects` | [`CanArray`](../modules/types.html#canarray)\<`object` \| [`Window`](https://developer.mozilla.org/docs/Web/API/Window) \| [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)\> |
| `events?` | [`CanArray`](../modules/types.html#canarray)\<`string`\> |
| `callback?` | [`CallbackFunction`](./types.CallbackFunction.html)\<`any`\> |

##### Returns

`IEventEmitter`

***

### stopPropagation()

**stopPropagation**(`subjectOrEvents`, `eventsList?`): `void`

Defined in: [src/types/events.d.ts:137](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L137)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `subjectOrEvents` | `string` \| `object` |
| `eventsList?` | `string` |

#### Returns

`void`

***

#### Call Signature

**fire**(`eventsList`, ...`args?`): `any`

Defined in: [src/types/events.d.ts:166](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L166)

Sets the handler for the specified event (Event List) for a given element .

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `eventsList` | `string` | List of events , separated by a space or comma |
| ...`args?` | `any`[] | Options for the event handler |

##### Returns

`any`

`false` if one of the handlers return `false`

##### Example

```javascript
var dialog = new Jodit.modules.Dialog();
parent.e.on('afterClose', function () {
    dialog.destruct(); // will be removed from DOM
});
dialog.open('Hello world!!!');
```
 or you can trigger native browser listener
```javascript
 var events = new Jodit.modules.EventEmitter();
 events.on(document.body, 'click',function (event) {
     alert('click on ' + event.target.id );
 });
 events.fire(document.body.querySelector('div'), 'click');
```

#### Call Signature

**fire**(`subject`, `eventsList`, ...`args`): `any`

Defined in: [src/types/events.d.ts:167](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L167)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `subject` | `object` |
| `eventsList` | `string` \| [`Event`](https://developer.mozilla.org/docs/Web/API/Event) |
| ...`args` | `any`[] |

##### Returns

`any`

#### Call Signature

**fire**(`subjectOrEvents`, `eventsList?`, ...`args`): `any`

Defined in: [src/types/events.d.ts:168](https://github.com/xdan/jodit/blob/main/src/types/events.d.ts#L168)

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `subjectOrEvents` | `string` \| `object` |
| `eventsList?` | `any` |
| ...`args?` | `any`[] |

##### Returns

`any`

***

### destruct()

**destruct**(`jodit?`): `any`

Defined in: [src/types/types.d.ts:32](https://github.com/xdan/jodit/blob/main/src/types/types.d.ts#L32)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `jodit?` | [`IViewBased`](./types.IViewBased.html)\<[`IViewOptions`](./types.IViewOptions.html)\> |

#### Returns

`any`

#### Inherited from

[`IDestructible`](./types.IDestructible.html).[`destruct`](./types.IDestructible.html#destruct)
