MCPcopy Create free account
hub / github.com/microsoft/SandDance / nap

Function nap

docs/tests/v2/es6/js/sanddance.js:119755–119773  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119753}
119754
119755function nap() {
119756 var t0,
119757 t1 = taskHead,
119758 t2,
119759 time = Infinity;
119760
119761 while (t1) {
119762 if (t1._call) {
119763 if (time > t1._time) time = t1._time;
119764 t0 = t1, t1 = t1._next;
119765 } else {
119766 t2 = t1._next, t1._next = null;
119767 t1 = t0 ? t0._next = t2 : taskHead = t2;
119768 }
119769 }
119770
119771 taskTail = t0;
119772 sleep(time);
119773}
119774
119775function sleep(time) {
119776 if (frame) return; // Soonest alarm already set, or will be.

Callers 1

wakeFunction · 0.70

Calls 1

sleepFunction · 0.70

Tested by

no test coverage detected