MCPcopy
hub / github.com/Justineo/github-hovercard / setTimeout

Function setTimeout

extensions/edge/timeout.js:5–23  ·  view source on GitHub ↗
(callback, delay)

Source from the content-addressed store, hash-verified

3var __nextId = 0;
4var __activeTimers = {};
5function setTimeout(callback, delay) {
6 var start = Date.now();
7 var timerId = __nextId++;
8
9 function check() {
10 if (!__activeTimers[timerId]) {
11 return;
12 }
13 if (Date.now() - start >= delay) {
14 callback();
15 } else {
16 requestAnimationFrame(check);
17 }
18 }
19 requestAnimationFrame(check);
20
21 __activeTimers[timerId] = true;
22 return timerId;
23}
24
25function clearTimeout(timerId) {
26 delete __activeTimers[timerId];

Callers 8

tooltipster.jsFile · 0.85
tooltipster.jsFile · 0.85
logFunction · 0.85
tooltipster.jsFile · 0.85
logFunction · 0.85
tooltipster.jsFile · 0.85
logFunction · 0.85
tooltipster.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected