diff options
Diffstat (limited to 'lib/timers.js')
-rw-r--r-- | lib/timers.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/timers.js b/lib/timers.js index 3d200344a4..5ae0e6a5ad 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -547,6 +547,10 @@ Timeout.prototype.ref = function() { return this; }; +Timeout.prototype.hasRef = function() { + return !!this[kRefed]; +}; + Timeout.prototype.close = function() { clearTimeout(this); return this; @@ -622,7 +626,7 @@ function processImmediate() { count++; if (immediate[kRefed]) refCount++; - immediate[kRefed] = undefined; + immediate[kRefed] = null; tryOnImmediate(immediate, tail, count, refCount); @@ -713,6 +717,10 @@ const Immediate = class Immediate { } return this; } + + hasRef() { + return !!this[kRefed]; + } }; function setImmediate(callback, arg1, arg2, arg3) { @@ -761,7 +769,7 @@ exports.clearImmediate = function clearImmediate(immediate) { if (immediate[kRefed] && --immediateInfo[kRefCount] === 0) toggleImmediateRef(false); - immediate[kRefed] = undefined; + immediate[kRefed] = null; if (destroyHooksExist()) { emitDestroy(immediate[async_id_symbol]); |