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