(now: number)
| 270 | }); |
| 271 | |
| 272 | function 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 | |
| 304 | function start(event: Event) { |
| 305 | if (!armed || event.type !== armed.event || !event.isTrusted) { |
nothing calls this directly
no test coverage detected