timers: set several methods EOL

PR-URL: https://github.com/nodejs/node/pull/56966
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Yagiz Nizipli 2025-02-10 16:09:41 -05:00 committed by GitHub
parent 3ea97d5c25
commit 5d7091f1bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 22 additions and 262 deletions

View file

@ -46,18 +46,14 @@ const {
},
kRefed,
kHasPrimitive,
getTimerDuration,
timerListMap,
timerListQueue,
immediateQueue,
active,
unrefActive,
insert,
knownTimersById,
} = require('internal/timers');
const {
promisify: { custom: customPromisify },
deprecate,
} = require('internal/util');
let debug = require('internal/util/debuglog').debuglog('timer', (fn) => {
debug = fn;
@ -111,20 +107,6 @@ function unenroll(item) {
item._idleTimeout = -1;
}
// Make a regular object able to act as a timer by setting some properties.
// This function does not start the timer, see `active()`.
// Using existing objects as timers slightly reduces object overhead.
function enroll(item, msecs) {
msecs = getTimerDuration(msecs, 'msecs');
// If this item was already in a list somewhere
// then we should unenroll it from that
if (item._idleNext) unenroll(item);
L.init(item);
item._idleTimeout = msecs;
}
/**
* Schedules the execution of a one-time `callback`
@ -351,23 +333,6 @@ module.exports = timers = {
clearImmediate,
setInterval,
clearInterval,
_unrefActive: deprecate(
unrefActive,
'timers._unrefActive() is deprecated.' +
' Please use timeout.refresh() instead.',
'DEP0127'),
active: deprecate(
active,
'timers.active() is deprecated. Please use timeout.refresh() instead.',
'DEP0126'),
unenroll: deprecate(
unenroll,
'timers.unenroll() is deprecated. Please use clearTimeout instead.',
'DEP0096'),
enroll: deprecate(
enroll,
'timers.enroll() is deprecated. Please use setTimeout instead.',
'DEP0095'),
};
ObjectDefineProperties(timers, {