Skip to main content
Version: Next

Defer

defer

Defers the execution of a function.

Example

defer(() => {
console.log('This will run after a delay');
});

console.log('This will run immediately');
Signature
function defer<T>(fn: () => T, timeout:  = 0): void

Parameters

fn

parameter
() => T

timeout

parameter