waygraph / defineReadBlock
Function: defineReadBlock()
defineReadBlock(
options):ReadBlock
Defined in: src/engine/read/read-block.ts:52
Declares what a page shows, as typed data an agent or a test can read.
Parameters
options
Returns
Example
ts
export const PostReadBlock = defineReadBlock({
name: "read-post",
from: PostOpen,
instruction: {
read: (ctx) => Post({ title: ctx.page.text("h1"), likes: ctx.page.number(".likes") }),
},
});Deprecated
A page's what-it-shows is its read: (definePageBlock({ read: (ctx) => ({ ... }) })), keys as Page.read.x; a layout's is defineLayout({ read }). waygraph upgrade --codemod page-object moves a project.