A chainable function for delaying execution of a function or group of functions.

Parameters:
NameTypeDescription
fnfunction

Function to execute.

tnumber

Delay time in milliseconds.

Since
  • 1.0.0
Returns:

Returns the a function that can then be chained with another call.

Type: 
function
Example
import { delay } from "@gravityforms/utils";

function Example() {
  delay(fn1, 400).delay(fn2, 500);
}

function fn1() {
	console.log( 'fn1: ' + Date.now() );
}
function fn2() {
	console.log( 'fn2: ' + Date.now() );
}

Methods

(inner) schedule(fn, t)

Parameters:
NameTypeDescription
fn
t