MCPcopy Create free account
hub / github.com/Roy3838/Observer / onScreen

Function onScreen

app/e2e/patterns.ts:337–344  ·  view source on GitHub ↗
(from: number, to: number)

Source from the content-addressed store, hash-verified

335 // Who was on screen when: VS Code until the run starts, then the demo's switches.
336 const switches = [{ t: 0, name: 'vscode' }, ...marks(run, 'app').map(m => ({ t: m.t, name: m.data.name as string }))];
337 const onScreen = (from: number, to: number) => {
338 const secs = new Map<string, number>();
339 switches.forEach((s, i) => {
340 const a = Math.max(s.t, from), b = Math.min(switches[i + 1]?.t ?? Infinity, to);
341 if (b > a) secs.set(s.name, (secs.get(s.name) ?? 0) + (b - a) / 1000);
342 });
343 return [...secs].filter(([, s]) => s >= 15).map(([n]) => n);
344 };
345 const end = (run.triggerT ?? run.startT + 390_000) + 30_000;
346 const inRun = entries(run).filter(e => e.t >= run.startT && e.t <= end);
347 // Notes from a summarizer when there is one; otherwise whatever the MCP built wrote.

Callers 1

patterns.tsFile · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected