mirror of https://github.com/nodejs/node.git
timers: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36132 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>pull/36132/head
parent
8938d37251
commit
bd120207fb
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const {
|
||||
FunctionPrototypeBind,
|
||||
Promise,
|
||||
PromisePrototypeFinally,
|
||||
PromiseReject,
|
||||
|
@ -72,8 +73,9 @@ function setTimeout(after, value, options = {}) {
|
|||
if (!ref) timeout.unref();
|
||||
insert(timeout, timeout._idleTimeout);
|
||||
if (signal) {
|
||||
// eslint-disable-next-line no-undef
|
||||
oncancel = cancelListenerHandler.bind(timeout, clearTimeout, reject);
|
||||
oncancel = FunctionPrototypeBind(cancelListenerHandler,
|
||||
// eslint-disable-next-line no-undef
|
||||
timeout, clearTimeout, reject);
|
||||
signal.addEventListener('abort', oncancel);
|
||||
}
|
||||
});
|
||||
|
@ -121,8 +123,9 @@ function setImmediate(value, options = {}) {
|
|||
const immediate = new Immediate(resolve, [value]);
|
||||
if (!ref) immediate.unref();
|
||||
if (signal) {
|
||||
// eslint-disable-next-line no-undef
|
||||
oncancel = cancelListenerHandler.bind(immediate, clearImmediate, reject);
|
||||
oncancel = FunctionPrototypeBind(cancelListenerHandler,
|
||||
// eslint-disable-next-line no-undef
|
||||
immediate, clearImmediate, reject);
|
||||
signal.addEventListener('abort', oncancel);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue