---
title: "tinymce.dom.EventUtils"
description: "This class wraps the browsers native event logic with more convenient methods."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.dom.eventutils/"
md_url: "https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.dom.eventutils/index.md"
version: "6"
last_updated: "2024-04-03T06:12:53Z"
tokens: 786
---
Important This page documents TinyMCE 6. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.dom.eventutils/).
# tinymce.dom.EventUtils

This class wraps the browsers native event logic with more convenient methods.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [bind()](#bind) | Binds a callback to an event on the specified target. | `EventUtils` |
| [clean()](#clean) | Removes all bound event listeners for the specified target. This will also remove any bound listeners to child nodes within that target. | `EventUtils` |
| [dispatch()](#dispatch) | Dispatches the specified event on the specified target. | `EventUtils` |
| [fire()](#fire) | Fires the specified event on the specified target. <br> *Deprecated in TinyMCE 6.0 and has been marked for removal in TinyMCE 7.0. Use `dispatch` instead.* | `EventUtils` |
| [unbind()](#unbind) | Unbinds the specified event by name, name and callback or all events on the target. | `EventUtils` |

## Methods

### bind()

```javascript
bind(target: Object, name: String, callback: Function, scope: Object): Function
```
Binds a callback to an event on the specified target.

#### Parameters

- `target (Object)` - Target node/window or custom object.
- `name (String)` - Name of the event to bind.
- `callback (Function)` - Callback function to execute when the event occurs.
- `scope (Object)` - Scope to call the callback function on, defaults to target.

#### Return value

- `Function` - Callback function that got bound.

### clean()

```javascript
clean(target: Object): EventUtils
```
Removes all bound event listeners for the specified target. This will also remove any bound
listeners to child nodes within that target.

#### Parameters

- `target (Object)` - Target node/window object.

#### Return value

- `EventUtils` - Event utils instance.

### dispatch()

```javascript
dispatch(target: Node | window, name: String, args: Object): EventUtils
```
Dispatches the specified event on the specified target.

#### Parameters

- `target (Node | window)` - Target node/window or custom object.
- `name (String)` - Event name to dispatch.
- `args (Object)` - Optional arguments to send to the observers.

#### Return value

- `EventUtils` - Event utils instance.

### fire()

```javascript
fire(target: Object, name: String, args: Object): EventUtils
```
Fires the specified event on the specified target.

*Deprecated in TinyMCE 6.0 and has been marked for removal in TinyMCE 7.0. Use `dispatch` instead.*

#### Parameters

- `target (Object)` - Target node/window or custom object.
- `name (String)` - Event name to fire.
- `args (Object)` - Optional arguments to send to the observers.

#### Return value

- `EventUtils` - Event utils instance.

### unbind()

```javascript
unbind(target: Object, name: String, callback: Function): EventUtils
```
Unbinds the specified event by name, name and callback or all events on the target.

#### Parameters

- `target (Object)` - Target node/window or custom object.
- `name (String)` - Optional event name to unbind.
- `callback (Function)` - Optional callback function to unbind.

#### Return value

- `EventUtils` - Event utils instance.
