node/test/common/tick.js
RedYetiDev 5116578b8a test: remove unused common utilities
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>
2024-09-21 09:11:17 -07:00

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);
};