Async

async.Async

Implements

constructor

new Async(): Async

Returns

Async

isDestructed

isDestructed: boolean = false

Defined in

src/core/async/async.ts#423

delay

delay(timeout): RejectablePromise<void>

Parameters

Name Type
timeout number | IAsyncParams

Returns

RejectablePromise<void>

Implementation of

IAsync.delay

Defined in

src/core/async/async.ts#38


setTimeout

setTimeout(callback, timeout, ...args): number

Parameters

Name Type
callback Callback
timeout undefined | number | IAsyncParams
...args any[]

Returns

number

Implementation of

IAsync.setTimeout

Defined in

src/core/async/async.ts#42


updateTimeout

updateTimeout(label, timeout): Nullable<number>

Parameters

Name Type
label string
timeout number

Returns

Nullable<number>

Implementation of

IAsync.updateTimeout

Defined in

src/core/async/async.ts#75


clearTimeout

clearTimeout(timer): void

Parameters

Name Type
timer number

Returns

void

Implementation of

IAsync.clearTimeout

Defined in

src/core/async/async.ts#95

clearTimeout(label): void

Parameters

Name Type
label string

Returns

void

Implementation of

IAsync.clearTimeout

Defined in

src/core/async/async.ts#96


debounce

debounce(fn, timeout, firstCallImmediately?): CallbackFunction<any>

Debouncing enforces that a function not be called again until a certain amount of time has passed without
it being called. As in "execute this function only if 100 milliseconds have passed without it being called."

Parameters

Name Type Default value
fn CallbackFunction<any> undefined
timeout IAsyncParams | ITimeout undefined
firstCallImmediately boolean false

Returns

CallbackFunction<any>

Example

var jodit = Jodit.make('.editor');
jodit.e.on('mousemove', jodit.async.debounce(() => {
  // Do expensive things
}, 100));

Implementation of

IAsync.debounce

Defined in

src/core/async/async.ts#119


microDebounce

microDebounce<T>(fn, firstCallImmediately?): T

Type parameters

Name Type
T extends CallbackFunction<any>

Parameters

Name Type Default value
fn T undefined
firstCallImmediately boolean false

Returns

T

Implementation of

IAsync.microDebounce

Defined in

src/core/async/async.ts#184


throttle

throttle(fn, timeout, ignore?): CallbackFunction<any>

Throttling enforces a maximum number of times a function can be called over time.
As in "execute this function at most once every 100 milliseconds."

Parameters

Name Type Default value
fn CallbackFunction<any> undefined
timeout IAsyncParams | ITimeout undefined
ignore boolean false

Returns

CallbackFunction<any>

Example

var jodit = Jodit.make('.editor');
jodit.e.on(document.body, 'scroll', jodit.async.throttle(function() {
  // Do expensive things
}, 100));

Implementation of

IAsync.throttle

Defined in

src/core/async/async.ts#230


promise

promise<T>(executor): RejectablePromise<T>

Type parameters

Name
T

Parameters

Name Type
executor (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void

Returns

RejectablePromise<T>

Implementation of

IAsync.promise

Defined in

src/core/async/async.ts#272


promiseState

promiseState(p): Promise<"pending" | "fulfilled" | "rejected">

Get Promise status

Parameters

Name Type
p Promise<any>

Returns

Promise<"pending" | "fulfilled" | "rejected">

Implementation of

IAsync.promiseState

Defined in

src/core/async/async.ts#309


requestIdleCallback

requestIdleCallback(callback, options?): number

Parameters

Name Type
callback IdleRequestCallback
options? Object
options.timeout number

Returns

number

Implementation of

IAsync.requestIdleCallback

Defined in

src/core/async/async.ts#373


requestIdlePromise

requestIdlePromise(options?): RejectablePromise<number>

Parameters

Name Type
options? Object
options.timeout number

Returns

RejectablePromise<number>

Implementation of

IAsync.requestIdlePromise

Defined in

src/core/async/async.ts#382


cancelIdleCallback

cancelIdleCallback(request): void

Parameters

Name Type
request number

Returns

void

Implementation of

IAsync.cancelIdleCallback

Defined in

src/core/async/async.ts#393


requestAnimationFrame

requestAnimationFrame(callback): number

Smart wrapper for requestAnimationFrame

Parameters

Name Type
callback FrameRequestCallback

Returns

number

Implementation of

IAsync.requestAnimationFrame

Defined in

src/core/async/async.ts#398


cancelAnimationFrame

cancelAnimationFrame(request): void

Smart wrapper for cancelAnimationFrame

Parameters

Name Type
request number

Returns

void

Implementation of

IAsync.cancelAnimationFrame

Defined in

src/core/async/async.ts#404


clear

clear(): void

Returns

void

Implementation of

IAsync.clear

Defined in

src/core/async/async.ts#409


destruct

destruct(): any

Returns

any

Implementation of

IAsync.destruct

Defined in

jodit/src/core/async/async.ts:425