-
Notifications
You must be signed in to change notification settings - Fork 0
defer
Subhajit Sahu edited this page Jul 22, 2022
·
2 revisions
Generate deferred version of a function, that executes after the current stack has cleared.
Similar: defer, [delay].
function defer(x)
// x: a function
const {defer} = require('extra-function');
var count = 0;
var fn = defer(() => ++count);
fn();
fn();
// `count` incremented after 0s
// `count` incremented after 0s