2026-11-06 18:34:13 +00:00
|
|
|
// Standalone page for the ridge scene: full window, no host app. `?tier=still|low|full` picks the
|
2026-11-10 18:31:56 +00:00
|
|
|
// tier, `?probe=1` shows the rAF median/p95 readout. The bake record (each chunk's cost, from
|
|
|
|
|
// the scene's `onBake`) and the long tasks the page saw are on `window.bakes` and `window.longTasks`
|
|
|
|
|
// for a driver to read. Not shipped.
|
2026-11-06 18:34:13 +00:00
|
|
|
import { startBackgroundScene } from '../../src/app/features/scene';
|
|
|
|
|
import type { SceneTier } from '../../src/app/features/scene';
|
|
|
|
|
|
|
|
|
|
const q = new URLSearchParams(location.search);
|
|
|
|
|
const tier = (q.get('tier') ?? 'full') as SceneTier;
|
|
|
|
|
const canvas = document.getElementById('c') as HTMLCanvasElement;
|
2026-11-10 18:31:56 +00:00
|
|
|
const w = window as unknown as { scene: unknown; bakes: unknown[]; longTasks: number[]; firstViewMs: number };
|
|
|
|
|
w.bakes = [];
|
|
|
|
|
w.longTasks = [];
|
|
|
|
|
try {
|
|
|
|
|
new PerformanceObserver((l) => l.getEntries().forEach((e) => w.longTasks.push(e.duration))).observe({
|
|
|
|
|
entryTypes: ['longtask'],
|
|
|
|
|
});
|
|
|
|
|
} catch {
|
|
|
|
|
// No long-task entries in this browser.
|
|
|
|
|
}
|
|
|
|
|
const t0 = performance.now();
|
|
|
|
|
startBackgroundScene({ tier }, {}, {
|
|
|
|
|
canvas,
|
|
|
|
|
onBake: (b: unknown) => w.bakes.push(b),
|
|
|
|
|
} as never).then((scene) => {
|
|
|
|
|
w.firstViewMs = performance.now() - t0;
|
|
|
|
|
w.scene = scene;
|
2026-11-06 18:34:13 +00:00
|
|
|
document.title = scene ? 'ridge: running' : 'ridge: unavailable (CSS ground)';
|
|
|
|
|
});
|