11cb0ef41Sopenharmony_ci// Copyright Joyent, Inc. and other Node contributors. 21cb0ef41Sopenharmony_ci// 31cb0ef41Sopenharmony_ci// Permission is hereby granted, free of charge, to any person obtaining a 41cb0ef41Sopenharmony_ci// copy of this software and associated documentation files (the 51cb0ef41Sopenharmony_ci// "Software"), to deal in the Software without restriction, including 61cb0ef41Sopenharmony_ci// without limitation the rights to use, copy, modify, merge, publish, 71cb0ef41Sopenharmony_ci// distribute, sublicense, and/or sell copies of the Software, and to permit 81cb0ef41Sopenharmony_ci// persons to whom the Software is furnished to do so, subject to the 91cb0ef41Sopenharmony_ci// following conditions: 101cb0ef41Sopenharmony_ci// 111cb0ef41Sopenharmony_ci// The above copyright notice and this permission notice shall be included 121cb0ef41Sopenharmony_ci// in all copies or substantial portions of the Software. 131cb0ef41Sopenharmony_ci// 141cb0ef41Sopenharmony_ci// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 151cb0ef41Sopenharmony_ci// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 161cb0ef41Sopenharmony_ci// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 171cb0ef41Sopenharmony_ci// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 181cb0ef41Sopenharmony_ci// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 191cb0ef41Sopenharmony_ci// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 201cb0ef41Sopenharmony_ci// USE OR OTHER DEALINGS IN THE SOFTWARE. 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci'use strict'; 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciconst { 251cb0ef41Sopenharmony_ci MathTrunc, 261cb0ef41Sopenharmony_ci ObjectCreate, 271cb0ef41Sopenharmony_ci ObjectDefineProperty, 281cb0ef41Sopenharmony_ci SymbolDispose, 291cb0ef41Sopenharmony_ci SymbolToPrimitive, 301cb0ef41Sopenharmony_ci} = primordials; 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ciconst { 331cb0ef41Sopenharmony_ci immediateInfo, 341cb0ef41Sopenharmony_ci toggleImmediateRef, 351cb0ef41Sopenharmony_ci} = internalBinding('timers'); 361cb0ef41Sopenharmony_ciconst L = require('internal/linkedlist'); 371cb0ef41Sopenharmony_ciconst { 381cb0ef41Sopenharmony_ci async_id_symbol, 391cb0ef41Sopenharmony_ci Timeout, 401cb0ef41Sopenharmony_ci Immediate, 411cb0ef41Sopenharmony_ci decRefCount, 421cb0ef41Sopenharmony_ci immediateInfoFields: { 431cb0ef41Sopenharmony_ci kCount, 441cb0ef41Sopenharmony_ci kRefCount, 451cb0ef41Sopenharmony_ci }, 461cb0ef41Sopenharmony_ci kRefed, 471cb0ef41Sopenharmony_ci kHasPrimitive, 481cb0ef41Sopenharmony_ci getTimerDuration, 491cb0ef41Sopenharmony_ci timerListMap, 501cb0ef41Sopenharmony_ci timerListQueue, 511cb0ef41Sopenharmony_ci immediateQueue, 521cb0ef41Sopenharmony_ci active, 531cb0ef41Sopenharmony_ci unrefActive, 541cb0ef41Sopenharmony_ci insert, 551cb0ef41Sopenharmony_ci} = require('internal/timers'); 561cb0ef41Sopenharmony_ciconst { 571cb0ef41Sopenharmony_ci promisify: { custom: customPromisify }, 581cb0ef41Sopenharmony_ci deprecate, 591cb0ef41Sopenharmony_ci} = require('internal/util'); 601cb0ef41Sopenharmony_cilet debug = require('internal/util/debuglog').debuglog('timer', (fn) => { 611cb0ef41Sopenharmony_ci debug = fn; 621cb0ef41Sopenharmony_ci}); 631cb0ef41Sopenharmony_ciconst { validateFunction } = require('internal/validators'); 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_cilet timersPromises; 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ciconst { 681cb0ef41Sopenharmony_ci destroyHooksExist, 691cb0ef41Sopenharmony_ci // The needed emit*() functions. 701cb0ef41Sopenharmony_ci emitDestroy, 711cb0ef41Sopenharmony_ci} = require('internal/async_hooks'); 721cb0ef41Sopenharmony_ci 731cb0ef41Sopenharmony_ci// This stores all the known timer async ids to allow users to clearTimeout and 741cb0ef41Sopenharmony_ci// clearInterval using those ids, to match the spec and the rest of the web 751cb0ef41Sopenharmony_ci// platform. 761cb0ef41Sopenharmony_ciconst knownTimersById = ObjectCreate(null); 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci// Remove a timer. Cancels the timeout and resets the relevant timer properties. 791cb0ef41Sopenharmony_cifunction unenroll(item) { 801cb0ef41Sopenharmony_ci if (item._destroyed) 811cb0ef41Sopenharmony_ci return; 821cb0ef41Sopenharmony_ci 831cb0ef41Sopenharmony_ci item._destroyed = true; 841cb0ef41Sopenharmony_ci 851cb0ef41Sopenharmony_ci if (item[kHasPrimitive]) 861cb0ef41Sopenharmony_ci delete knownTimersById[item[async_id_symbol]]; 871cb0ef41Sopenharmony_ci 881cb0ef41Sopenharmony_ci // Fewer checks may be possible, but these cover everything. 891cb0ef41Sopenharmony_ci if (destroyHooksExist() && item[async_id_symbol] !== undefined) 901cb0ef41Sopenharmony_ci emitDestroy(item[async_id_symbol]); 911cb0ef41Sopenharmony_ci 921cb0ef41Sopenharmony_ci L.remove(item); 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_ci // We only delete refed lists because unrefed ones are incredibly likely 951cb0ef41Sopenharmony_ci // to come from http and be recreated shortly after. 961cb0ef41Sopenharmony_ci // TODO: Long-term this could instead be handled by creating an internal 971cb0ef41Sopenharmony_ci // clearTimeout that makes it clear that the list should not be deleted. 981cb0ef41Sopenharmony_ci // That function could then be used by http and other similar modules. 991cb0ef41Sopenharmony_ci if (item[kRefed]) { 1001cb0ef41Sopenharmony_ci // Compliment truncation during insert(). 1011cb0ef41Sopenharmony_ci const msecs = MathTrunc(item._idleTimeout); 1021cb0ef41Sopenharmony_ci const list = timerListMap[msecs]; 1031cb0ef41Sopenharmony_ci if (list !== undefined && L.isEmpty(list)) { 1041cb0ef41Sopenharmony_ci debug('unenroll: list empty'); 1051cb0ef41Sopenharmony_ci timerListQueue.removeAt(list.priorityQueuePosition); 1061cb0ef41Sopenharmony_ci delete timerListMap[list.msecs]; 1071cb0ef41Sopenharmony_ci } 1081cb0ef41Sopenharmony_ci 1091cb0ef41Sopenharmony_ci decRefCount(); 1101cb0ef41Sopenharmony_ci } 1111cb0ef41Sopenharmony_ci 1121cb0ef41Sopenharmony_ci // If active is called later, then we want to make sure not to insert again 1131cb0ef41Sopenharmony_ci item._idleTimeout = -1; 1141cb0ef41Sopenharmony_ci} 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_ci// Make a regular object able to act as a timer by setting some properties. 1171cb0ef41Sopenharmony_ci// This function does not start the timer, see `active()`. 1181cb0ef41Sopenharmony_ci// Using existing objects as timers slightly reduces object overhead. 1191cb0ef41Sopenharmony_cifunction enroll(item, msecs) { 1201cb0ef41Sopenharmony_ci msecs = getTimerDuration(msecs, 'msecs'); 1211cb0ef41Sopenharmony_ci 1221cb0ef41Sopenharmony_ci // If this item was already in a list somewhere 1231cb0ef41Sopenharmony_ci // then we should unenroll it from that 1241cb0ef41Sopenharmony_ci if (item._idleNext) unenroll(item); 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci L.init(item); 1271cb0ef41Sopenharmony_ci item._idleTimeout = msecs; 1281cb0ef41Sopenharmony_ci} 1291cb0ef41Sopenharmony_ci 1301cb0ef41Sopenharmony_ci 1311cb0ef41Sopenharmony_ci/** 1321cb0ef41Sopenharmony_ci * Schedules the execution of a one-time `callback` 1331cb0ef41Sopenharmony_ci * after `after` milliseconds. 1341cb0ef41Sopenharmony_ci * @param {Function} callback 1351cb0ef41Sopenharmony_ci * @param {number} [after] 1361cb0ef41Sopenharmony_ci * @param {any} [arg1] 1371cb0ef41Sopenharmony_ci * @param {any} [arg2] 1381cb0ef41Sopenharmony_ci * @param {any} [arg3] 1391cb0ef41Sopenharmony_ci * @returns {Timeout} 1401cb0ef41Sopenharmony_ci */ 1411cb0ef41Sopenharmony_cifunction setTimeout(callback, after, arg1, arg2, arg3) { 1421cb0ef41Sopenharmony_ci validateFunction(callback, 'callback'); 1431cb0ef41Sopenharmony_ci 1441cb0ef41Sopenharmony_ci let i, args; 1451cb0ef41Sopenharmony_ci switch (arguments.length) { 1461cb0ef41Sopenharmony_ci // fast cases 1471cb0ef41Sopenharmony_ci case 1: 1481cb0ef41Sopenharmony_ci case 2: 1491cb0ef41Sopenharmony_ci break; 1501cb0ef41Sopenharmony_ci case 3: 1511cb0ef41Sopenharmony_ci args = [arg1]; 1521cb0ef41Sopenharmony_ci break; 1531cb0ef41Sopenharmony_ci case 4: 1541cb0ef41Sopenharmony_ci args = [arg1, arg2]; 1551cb0ef41Sopenharmony_ci break; 1561cb0ef41Sopenharmony_ci default: 1571cb0ef41Sopenharmony_ci args = [arg1, arg2, arg3]; 1581cb0ef41Sopenharmony_ci for (i = 5; i < arguments.length; i++) { 1591cb0ef41Sopenharmony_ci // Extend array dynamically, makes .apply run much faster in v6.0.0 1601cb0ef41Sopenharmony_ci args[i - 2] = arguments[i]; 1611cb0ef41Sopenharmony_ci } 1621cb0ef41Sopenharmony_ci break; 1631cb0ef41Sopenharmony_ci } 1641cb0ef41Sopenharmony_ci 1651cb0ef41Sopenharmony_ci const timeout = new Timeout(callback, after, args, false, true); 1661cb0ef41Sopenharmony_ci insert(timeout, timeout._idleTimeout); 1671cb0ef41Sopenharmony_ci 1681cb0ef41Sopenharmony_ci return timeout; 1691cb0ef41Sopenharmony_ci} 1701cb0ef41Sopenharmony_ci 1711cb0ef41Sopenharmony_ciObjectDefineProperty(setTimeout, customPromisify, { 1721cb0ef41Sopenharmony_ci __proto__: null, 1731cb0ef41Sopenharmony_ci enumerable: true, 1741cb0ef41Sopenharmony_ci get() { 1751cb0ef41Sopenharmony_ci if (!timersPromises) 1761cb0ef41Sopenharmony_ci timersPromises = require('timers/promises'); 1771cb0ef41Sopenharmony_ci return timersPromises.setTimeout; 1781cb0ef41Sopenharmony_ci }, 1791cb0ef41Sopenharmony_ci}); 1801cb0ef41Sopenharmony_ci 1811cb0ef41Sopenharmony_ci/** 1821cb0ef41Sopenharmony_ci * Cancels a timeout. 1831cb0ef41Sopenharmony_ci * @param {Timeout | string | number} timer 1841cb0ef41Sopenharmony_ci * @returns {void} 1851cb0ef41Sopenharmony_ci */ 1861cb0ef41Sopenharmony_cifunction clearTimeout(timer) { 1871cb0ef41Sopenharmony_ci if (timer && timer._onTimeout) { 1881cb0ef41Sopenharmony_ci timer._onTimeout = null; 1891cb0ef41Sopenharmony_ci unenroll(timer); 1901cb0ef41Sopenharmony_ci return; 1911cb0ef41Sopenharmony_ci } 1921cb0ef41Sopenharmony_ci if (typeof timer === 'number' || typeof timer === 'string') { 1931cb0ef41Sopenharmony_ci const timerInstance = knownTimersById[timer]; 1941cb0ef41Sopenharmony_ci if (timerInstance !== undefined) { 1951cb0ef41Sopenharmony_ci timerInstance._onTimeout = null; 1961cb0ef41Sopenharmony_ci unenroll(timerInstance); 1971cb0ef41Sopenharmony_ci } 1981cb0ef41Sopenharmony_ci } 1991cb0ef41Sopenharmony_ci} 2001cb0ef41Sopenharmony_ci 2011cb0ef41Sopenharmony_ci/** 2021cb0ef41Sopenharmony_ci * Schedules repeated execution of `callback` 2031cb0ef41Sopenharmony_ci * every `repeat` milliseconds. 2041cb0ef41Sopenharmony_ci * @param {Function} callback 2051cb0ef41Sopenharmony_ci * @param {number} [repeat] 2061cb0ef41Sopenharmony_ci * @param {any} [arg1] 2071cb0ef41Sopenharmony_ci * @param {any} [arg2] 2081cb0ef41Sopenharmony_ci * @param {any} [arg3] 2091cb0ef41Sopenharmony_ci * @returns {Timeout} 2101cb0ef41Sopenharmony_ci */ 2111cb0ef41Sopenharmony_cifunction setInterval(callback, repeat, arg1, arg2, arg3) { 2121cb0ef41Sopenharmony_ci validateFunction(callback, 'callback'); 2131cb0ef41Sopenharmony_ci 2141cb0ef41Sopenharmony_ci let i, args; 2151cb0ef41Sopenharmony_ci switch (arguments.length) { 2161cb0ef41Sopenharmony_ci // fast cases 2171cb0ef41Sopenharmony_ci case 1: 2181cb0ef41Sopenharmony_ci case 2: 2191cb0ef41Sopenharmony_ci break; 2201cb0ef41Sopenharmony_ci case 3: 2211cb0ef41Sopenharmony_ci args = [arg1]; 2221cb0ef41Sopenharmony_ci break; 2231cb0ef41Sopenharmony_ci case 4: 2241cb0ef41Sopenharmony_ci args = [arg1, arg2]; 2251cb0ef41Sopenharmony_ci break; 2261cb0ef41Sopenharmony_ci default: 2271cb0ef41Sopenharmony_ci args = [arg1, arg2, arg3]; 2281cb0ef41Sopenharmony_ci for (i = 5; i < arguments.length; i++) { 2291cb0ef41Sopenharmony_ci // Extend array dynamically, makes .apply run much faster in v6.0.0 2301cb0ef41Sopenharmony_ci args[i - 2] = arguments[i]; 2311cb0ef41Sopenharmony_ci } 2321cb0ef41Sopenharmony_ci break; 2331cb0ef41Sopenharmony_ci } 2341cb0ef41Sopenharmony_ci 2351cb0ef41Sopenharmony_ci const timeout = new Timeout(callback, repeat, args, true, true); 2361cb0ef41Sopenharmony_ci insert(timeout, timeout._idleTimeout); 2371cb0ef41Sopenharmony_ci 2381cb0ef41Sopenharmony_ci return timeout; 2391cb0ef41Sopenharmony_ci} 2401cb0ef41Sopenharmony_ci 2411cb0ef41Sopenharmony_ci/** 2421cb0ef41Sopenharmony_ci * Cancels an interval. 2431cb0ef41Sopenharmony_ci * @param {Timeout | string | number} timer 2441cb0ef41Sopenharmony_ci * @returns {void} 2451cb0ef41Sopenharmony_ci */ 2461cb0ef41Sopenharmony_cifunction clearInterval(timer) { 2471cb0ef41Sopenharmony_ci // clearTimeout and clearInterval can be used to clear timers created from 2481cb0ef41Sopenharmony_ci // both setTimeout and setInterval, as specified by HTML Living Standard: 2491cb0ef41Sopenharmony_ci // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval 2501cb0ef41Sopenharmony_ci clearTimeout(timer); 2511cb0ef41Sopenharmony_ci} 2521cb0ef41Sopenharmony_ci 2531cb0ef41Sopenharmony_ciTimeout.prototype.close = function() { 2541cb0ef41Sopenharmony_ci clearTimeout(this); 2551cb0ef41Sopenharmony_ci return this; 2561cb0ef41Sopenharmony_ci}; 2571cb0ef41Sopenharmony_ci 2581cb0ef41Sopenharmony_ciTimeout.prototype[SymbolDispose] = function() { 2591cb0ef41Sopenharmony_ci clearTimeout(this); 2601cb0ef41Sopenharmony_ci}; 2611cb0ef41Sopenharmony_ci 2621cb0ef41Sopenharmony_ci/** 2631cb0ef41Sopenharmony_ci * Coerces a `Timeout` to a primitive. 2641cb0ef41Sopenharmony_ci * @returns {number} 2651cb0ef41Sopenharmony_ci */ 2661cb0ef41Sopenharmony_ciTimeout.prototype[SymbolToPrimitive] = function() { 2671cb0ef41Sopenharmony_ci const id = this[async_id_symbol]; 2681cb0ef41Sopenharmony_ci if (!this[kHasPrimitive]) { 2691cb0ef41Sopenharmony_ci this[kHasPrimitive] = true; 2701cb0ef41Sopenharmony_ci knownTimersById[id] = this; 2711cb0ef41Sopenharmony_ci } 2721cb0ef41Sopenharmony_ci return id; 2731cb0ef41Sopenharmony_ci}; 2741cb0ef41Sopenharmony_ci 2751cb0ef41Sopenharmony_ci/** 2761cb0ef41Sopenharmony_ci * Schedules the immediate execution of `callback` 2771cb0ef41Sopenharmony_ci * after I/O events' callbacks. 2781cb0ef41Sopenharmony_ci * @param {Function} callback 2791cb0ef41Sopenharmony_ci * @param {any} [arg1] 2801cb0ef41Sopenharmony_ci * @param {any} [arg2] 2811cb0ef41Sopenharmony_ci * @param {any} [arg3] 2821cb0ef41Sopenharmony_ci * @returns {Immediate} 2831cb0ef41Sopenharmony_ci */ 2841cb0ef41Sopenharmony_cifunction setImmediate(callback, arg1, arg2, arg3) { 2851cb0ef41Sopenharmony_ci validateFunction(callback, 'callback'); 2861cb0ef41Sopenharmony_ci 2871cb0ef41Sopenharmony_ci let i, args; 2881cb0ef41Sopenharmony_ci switch (arguments.length) { 2891cb0ef41Sopenharmony_ci // fast cases 2901cb0ef41Sopenharmony_ci case 1: 2911cb0ef41Sopenharmony_ci break; 2921cb0ef41Sopenharmony_ci case 2: 2931cb0ef41Sopenharmony_ci args = [arg1]; 2941cb0ef41Sopenharmony_ci break; 2951cb0ef41Sopenharmony_ci case 3: 2961cb0ef41Sopenharmony_ci args = [arg1, arg2]; 2971cb0ef41Sopenharmony_ci break; 2981cb0ef41Sopenharmony_ci default: 2991cb0ef41Sopenharmony_ci args = [arg1, arg2, arg3]; 3001cb0ef41Sopenharmony_ci for (i = 4; i < arguments.length; i++) { 3011cb0ef41Sopenharmony_ci // Extend array dynamically, makes .apply run much faster in v6.0.0 3021cb0ef41Sopenharmony_ci args[i - 1] = arguments[i]; 3031cb0ef41Sopenharmony_ci } 3041cb0ef41Sopenharmony_ci break; 3051cb0ef41Sopenharmony_ci } 3061cb0ef41Sopenharmony_ci 3071cb0ef41Sopenharmony_ci return new Immediate(callback, args); 3081cb0ef41Sopenharmony_ci} 3091cb0ef41Sopenharmony_ci 3101cb0ef41Sopenharmony_ciObjectDefineProperty(setImmediate, customPromisify, { 3111cb0ef41Sopenharmony_ci __proto__: null, 3121cb0ef41Sopenharmony_ci enumerable: true, 3131cb0ef41Sopenharmony_ci get() { 3141cb0ef41Sopenharmony_ci if (!timersPromises) 3151cb0ef41Sopenharmony_ci timersPromises = require('timers/promises'); 3161cb0ef41Sopenharmony_ci return timersPromises.setImmediate; 3171cb0ef41Sopenharmony_ci }, 3181cb0ef41Sopenharmony_ci}); 3191cb0ef41Sopenharmony_ci 3201cb0ef41Sopenharmony_ci/** 3211cb0ef41Sopenharmony_ci * Cancels an immediate. 3221cb0ef41Sopenharmony_ci * @param {Immediate} immediate 3231cb0ef41Sopenharmony_ci * @returns {void} 3241cb0ef41Sopenharmony_ci */ 3251cb0ef41Sopenharmony_cifunction clearImmediate(immediate) { 3261cb0ef41Sopenharmony_ci if (!immediate || immediate._destroyed) 3271cb0ef41Sopenharmony_ci return; 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ci immediateInfo[kCount]--; 3301cb0ef41Sopenharmony_ci immediate._destroyed = true; 3311cb0ef41Sopenharmony_ci 3321cb0ef41Sopenharmony_ci if (immediate[kRefed] && --immediateInfo[kRefCount] === 0) 3331cb0ef41Sopenharmony_ci toggleImmediateRef(false); 3341cb0ef41Sopenharmony_ci immediate[kRefed] = null; 3351cb0ef41Sopenharmony_ci 3361cb0ef41Sopenharmony_ci if (destroyHooksExist() && immediate[async_id_symbol] !== undefined) { 3371cb0ef41Sopenharmony_ci emitDestroy(immediate[async_id_symbol]); 3381cb0ef41Sopenharmony_ci } 3391cb0ef41Sopenharmony_ci 3401cb0ef41Sopenharmony_ci immediate._onImmediate = null; 3411cb0ef41Sopenharmony_ci 3421cb0ef41Sopenharmony_ci immediateQueue.remove(immediate); 3431cb0ef41Sopenharmony_ci} 3441cb0ef41Sopenharmony_ci 3451cb0ef41Sopenharmony_ciImmediate.prototype[SymbolDispose] = function() { 3461cb0ef41Sopenharmony_ci clearImmediate(this); 3471cb0ef41Sopenharmony_ci}; 3481cb0ef41Sopenharmony_ci 3491cb0ef41Sopenharmony_cimodule.exports = { 3501cb0ef41Sopenharmony_ci setTimeout, 3511cb0ef41Sopenharmony_ci clearTimeout, 3521cb0ef41Sopenharmony_ci setImmediate, 3531cb0ef41Sopenharmony_ci clearImmediate, 3541cb0ef41Sopenharmony_ci setInterval, 3551cb0ef41Sopenharmony_ci clearInterval, 3561cb0ef41Sopenharmony_ci _unrefActive: deprecate( 3571cb0ef41Sopenharmony_ci unrefActive, 3581cb0ef41Sopenharmony_ci 'timers._unrefActive() is deprecated.' + 3591cb0ef41Sopenharmony_ci ' Please use timeout.refresh() instead.', 3601cb0ef41Sopenharmony_ci 'DEP0127'), 3611cb0ef41Sopenharmony_ci active: deprecate( 3621cb0ef41Sopenharmony_ci active, 3631cb0ef41Sopenharmony_ci 'timers.active() is deprecated. Please use timeout.refresh() instead.', 3641cb0ef41Sopenharmony_ci 'DEP0126'), 3651cb0ef41Sopenharmony_ci unenroll: deprecate( 3661cb0ef41Sopenharmony_ci unenroll, 3671cb0ef41Sopenharmony_ci 'timers.unenroll() is deprecated. Please use clearTimeout instead.', 3681cb0ef41Sopenharmony_ci 'DEP0096'), 3691cb0ef41Sopenharmony_ci enroll: deprecate( 3701cb0ef41Sopenharmony_ci enroll, 3711cb0ef41Sopenharmony_ci 'timers.enroll() is deprecated. Please use setTimeout instead.', 3721cb0ef41Sopenharmony_ci 'DEP0095'), 3731cb0ef41Sopenharmony_ci}; 374