MCPcopy Create free account
hub / github.com/angular/dev-infra / onTick

Function onTick

github-actions/saucelabs/set-saucelabs-env.js:2433–2460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

tickFunction · 0.70

Calls 1

refreshTimeoutFunction · 0.70

Tested by

no test coverage detected