MCPcopy Create free account
hub / github.com/adobe/react-spectrum / tick

Function tick

perf/app/measure.ts:272–302  ·  view source on GitHub ↗
(now: number)

Source from the content-addressed store, hash-verified

270});
271
272function tick(now: number) {
273 if (!sample || !armed) {
274 return;
275 }
276 if (armed.frames && lastFrame !== undefined) {
277 sample.frameIntervals.push(now - lastFrame);
278 }
279 lastFrame = now;
280 if (calibrationMode === 'frame' && !finishing) {
281 busy(calibrationDelay);
282 }
283 if (armed.layout && !finishing && matches(armed.conditions)) {
284 let layout = readLayout(armed.layout);
285 let signature = layout ? layoutSignature(layout) : undefined;
286 stableLayoutFrames = signature && signature === previousLayout ? stableLayoutFrames + 1 : 1;
287 previousLayout = signature;
288 if (layout && stableLayoutFrames >= 3) {
289 sample.layout = layout;
290 check(true);
291 }
292 } else {
293 if (armed.layout && !finishing) {
294 previousLayout = undefined;
295 stableLayoutFrames = 0;
296 }
297 check();
298 }
299 if (!sample.renderingOpportunity) {
300 frame = requestAnimationFrame(tick);
301 }
302}
303
304function start(event: Event) {
305 if (!armed || event.type !== armed.event || !event.isTrusted) {

Callers

nothing calls this directly

Calls 6

readLayoutFunction · 0.90
layoutSignatureFunction · 0.90
busyFunction · 0.85
matchesFunction · 0.85
checkFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected