const event = await io.waitForEvent( "wait", { name: "my.event", schema: z.object({ id: z.string(), createdAt: z.coerce.date(), isAdmin: z.boolean(), }), filter: { isAdmin: [true], // Only wait for events where isAdmin is true }, }, { timeoutInSeconds: 60 * 60, // Wait for up to an hour } );
io.waitForEvent() waits for the next event to be emitted, and returns the event data
io.waitForEvent()
run()
Hide fields
event.payload
any
Hide options
Was this page helpful?