mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
5116578b8a
PR-URL: https://github.com/nodejs/node/pull/54825 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
13 lines
218 B
JavaScript
13 lines
218 B
JavaScript
'use strict';
|
|
|
|
module.exports = function tick(x, cb) {
|
|
function ontick() {
|
|
if (--x === 0) {
|
|
if (typeof cb === 'function') cb();
|
|
} else {
|
|
setImmediate(ontick);
|
|
}
|
|
}
|
|
setImmediate(ontick);
|
|
};
|