MCPcopy Index your code
hub / github.com/shipshapecode/tether / tick

Function tick

src/js/tether.js:88–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86 let pendingTimeout = null;
87
88 const tick = () => {
89 if (!isUndefined(lastDuration) && lastDuration > 16) {
90 // We voluntarily throttle ourselves if we can't manage 60fps
91 lastDuration = Math.min(lastDuration - 16, 250);
92
93 // Just in case this is the last event, remember to position just once more
94 pendingTimeout = setTimeout(tick, 250);
95 return;
96 }
97
98 if (!isUndefined(lastCall) && now() - lastCall < 10) {
99 // Some browsers call events a little too frequently, refuse to run more than is reasonable
100 return;
101 }
102
103 if (pendingTimeout != null) {
104 clearTimeout(pendingTimeout);
105 pendingTimeout = null;
106 }
107
108 lastCall = now();
109 position();
110 lastDuration = now() - lastCall;
111 };
112
113 if (typeof window !== 'undefined' && !isUndefined(window.addEventListener)) {
114 ['resize', 'scroll', 'touchmove'].forEach((event) => {

Callers

nothing calls this directly

Calls 3

isUndefinedFunction · 0.90
nowFunction · 0.85
positionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…