---
title: "tinymce.util.Delay"
description: "Utility class for working with delayed actions like setTimeout."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.util.delay/"
md_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.util.delay/index.md"
version: "latest"
last_updated: "2022-07-13T05:38:26Z"
tokens: 436
---
# tinymce.util.Delay

Utility class for working with delayed actions like setTimeout.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [setEditorInterval()](#setEditorInterval) | Sets an interval timer that’s similar to native browser [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) API, except that it checks if the editor instance is still alive when the callback gets executed. | `Delay` |
| [setEditorTimeout()](#setEditorTimeout) | Sets a timeout that’s similar to the native browser [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) API, except that it checks if the editor instance is still alive when the callback gets executed. | `Delay` |

## Methods

### setEditorInterval()

```javascript
setEditorInterval(callback: Function, time: Number): Number
```
Sets an interval timer that’s similar to native browser [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) API, except that it checks if the editor instance is still alive when the callback gets executed.

#### Parameters

- `callback (Function)` - Callback to execute when interval time runs out.
- `time (Number)` - Optional time to wait before the callback is executed, defaults to 0.

#### Return value

- `Number` - Timeout id number.

### setEditorTimeout()

```javascript
setEditorTimeout(editor: tinymce.Editor, callback: Function, time: Number): Number
```
Sets a timeout that’s similar to the native browser [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) API, except that it checks if the editor instance is still alive when the callback gets executed.

#### Parameters

- `editor (Editor)` - Editor instance to check the removed state on.
- `callback (Function)` - Callback to execute when timer runs out.
- `time (Number)` - Optional time to wait before the callback is executed, defaults to 0.

#### Return value

- `Number` - Timeout id number.
