Skip to content

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 ​

MemPage

maxSteps? ​

number = 5000

Returns ​

Promise<TOut>

Example ​

ts
async observe(page, mem) {
  const receipt = await spawnTab(EmailReceiptFlow, page, mem);
  mem.set(ReceiptCode, receipt.__state);
}

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed