()
| 2431 | var PENDING = 0; |
| 2432 | var ACTIVE = 1; |
| 2433 | function onTick() { |
| 2434 | fastNow += TICK_MS; |
| 2435 | let idx = 0; |
| 2436 | let len = fastTimers.length; |
| 2437 | while (idx < len) { |
| 2438 | const timer = fastTimers[idx]; |
| 2439 | if (timer._state === PENDING) { |
| 2440 | timer._idleStart = fastNow - TICK_MS; |
| 2441 | timer._state = ACTIVE; |
| 2442 | } else if (timer._state === ACTIVE && fastNow >= timer._idleStart + timer._idleTimeout) { |
| 2443 | timer._state = TO_BE_CLEARED; |
| 2444 | timer._idleStart = -1; |
| 2445 | timer._onTimeout(timer._timerArg); |
| 2446 | } |
| 2447 | if (timer._state === TO_BE_CLEARED) { |
| 2448 | timer._state = NOT_IN_LIST; |
| 2449 | if (--len !== 0) { |
| 2450 | fastTimers[idx] = fastTimers[len]; |
| 2451 | } |
| 2452 | } else { |
| 2453 | ++idx; |
| 2454 | } |
| 2455 | } |
| 2456 | fastTimers.length = len; |
| 2457 | if (fastTimers.length !== 0) { |
| 2458 | refreshTimeout(); |
| 2459 | } |
| 2460 | } |
| 2461 | function refreshTimeout() { |
| 2462 | if (fastNowTimeout) { |
| 2463 | fastNowTimeout.refresh(); |
no test coverage detected