waygraph / spawnTab
Function: spawnTab()
spawnTab<
TOut>(entry,page,mem,maxSteps?):Promise<TOut>
Defined in: src/engine/run/run.ts:210
Drives a genuinely separate second tab through its own Block/Flow, in the same browser context an existing page already belongs to - the primitive observe() is specifically allowed to reach for (see Instruction.observe), since act/resolve can't touch page.context() at all. A thin, named wrapper around runGraph (which already opens its own page from whatever context it's given) rather than a new mechanism - the point is making the pattern discoverable and giving it a real name, not inventing new tab-lifecycle logic. The spawned tab is closed (by runGraph's own finally) before this resolves; the original page is never touched.
Type Parameters
TOut
TOut extends Checkpoint<string>
Parameters
entry
Block<Checkpoint<"__start__">, TOut>
page
Page
mem
maxSteps?
number = 5000
Returns
Promise<TOut>
Example
async observe(page, mem) {
const receipt = await spawnTab(EmailReceiptFlow, page, mem);
mem.set(ReceiptCode, receipt.__state);
}