function reusablePageSlot
reusablePageSlot(state: RunState): { page: Page | null; } | null

The daemon's reusable Page slot, or null when reuse does not apply.

Reuse is single-group only. In concurrent group mode group 0 would otherwise drain slot.page (Browser.setup consumes it) without re-stashing it, leaving the slot empty for the next single-file run — so a transient multi-file invocation would cost the following run a fresh newPage(). Withholding the slot here keeps the warm page untouched instead.

Both consumers — the drain in Browser.setup and the re-stash in run() — go through this, so the rule lives in one place rather than in two guards that must agree.

import * as RunState from './run-state.ts';

const state = RunState.create();
RunState.reusablePageSlot(state); // null — not a daemon run, nothing to reuse
RunState.reusablePageSlot({ ...state, groupCount: 3 }); // null — withheld in concurrent group mode

Parameters

state: RunState

Return Type

{ page: Page | null; } | null

Usage

import { reusablePageSlot } from "lib/setup/run-state.ts";