Skip to content
Subhajit Sahu edited this page Aug 7, 2022 · 1 revision

Generate deferred version of a function, that executes after the current stack has cleared.

Similar: defer, delay.


function defer(x)
// x: a function

const xasyncfn = require('extra-async-function');


var count = 0;
var fn = xasyncfn.defer(() => ++count);
fn();
fn();
// `count` incremented after 0s
// `count` incremented after 0s


References

Clone this wiki locally