Async
async.Async
Implements
constructor
new Async(): Async
Returns
isDestructed
isDestructed: boolean
= false
Defined in
delay
delay(timeout
): RejectablePromise
<void
>
Parameters
Name | Type |
---|---|
timeout |
number | IAsyncParams |
Returns
RejectablePromise
<void
>
Implementation of
Defined in
setTimeout
setTimeout(callback
, timeout
, ...args
): number
Parameters
Name | Type |
---|---|
callback |
Callback |
timeout |
undefined | number | IAsyncParams |
...args |
any [] |
Returns
number
Implementation of
Defined in
updateTimeout
updateTimeout(label
, timeout
): Nullable
<number
>
Parameters
Name | Type |
---|---|
label |
string |
timeout |
number |
Returns
Nullable
<number
>
Implementation of
Defined in
clearTimeout
clearTimeout(timer
): void
Parameters
Name | Type |
---|---|
timer |
number |
Returns
void
Implementation of
Defined in
clearTimeout(label
): void
Parameters
Name | Type |
---|---|
label |
string |
Returns
void
Implementation of
Defined in
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
Defined in
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
Defined in
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
Defined in
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
Implementation of
Defined in
promiseState
promiseState(p
): Promise
<"pending"
| "fulfilled"
| "rejected"
>
Get Promise status
Parameters
Name | Type |
---|---|
p |
Promise <any > |
Returns
Promise
<"pending"
| "fulfilled"
| "rejected"
>
Implementation of
Defined in
requestIdleCallback
requestIdleCallback(callback
, options?
): number
Parameters
Name | Type |
---|---|
callback |
IdleRequestCallback |
options? |
Object |
options.timeout |
number |
Returns
number
Implementation of
Defined in
requestIdlePromise
requestIdlePromise(options?
): RejectablePromise
<number
>
Parameters
Name | Type |
---|---|
options? |
Object |
options.timeout |
number |
Returns
RejectablePromise
<number
>
Implementation of
Defined in
cancelIdleCallback
cancelIdleCallback(request
): void
Parameters
Name | Type |
---|---|
request |
number |
Returns
void
Implementation of
Defined in
requestAnimationFrame
requestAnimationFrame(callback
): number
Smart wrapper for requestAnimationFrame
Parameters
Name | Type |
---|---|
callback |
FrameRequestCallback |
Returns
number
Implementation of
Defined in
cancelAnimationFrame
cancelAnimationFrame(request
): void
Smart wrapper for cancelAnimationFrame
Parameters
Name | Type |
---|---|
request |
number |
Returns
void
Implementation of
Defined in
clear
clear(): void
Returns
void
Implementation of
Defined in
destruct
destruct(): any
Returns
any
Implementation of
Defined in
jodit/src/core/async/async.ts:427