*** title: context.on description: Subscribe to browser-context events through the runtime event bridge. ---------------------------------------------------------------------------------- `context.on` is a browser runtime capability in the `context` namespace. ## Availability * Runtime: `browser` * Kind: `event` * Category: `events` * Supported drivers: Playwright ## SDK Surface * SDK path: `runtime.browserContext.on` * Async: No ## HTTP Surface * Transport: resource route * Route: `POST /workspaces/{id}/runtimes/{alias}/events/wait` * Long-running: No ## Reference Semantics * Requires refs: `context` ## Arguments | Argument | Type | Required | Description | | ----------- | ---------- | -------- | ---------------------------------------------- | | `eventName` | `string` | Yes | Context event name to subscribe to. | | `listener` | `function` | Yes | Local SDK listener invoked on matching events. | ## Result * Type: `runtime listener` * Description: Registers a local SDK listener for context events. ## SDK Example ```ts runtime.browserContext.on('console', (event) => { console.log(event); }); ``` ## HTTP Example ```http POST /workspaces/{id}/runtimes/{alias}/events/wait ``` ## Related Capabilities * [`context.once`](../events/context-once) * [`context.off`](../events/context-off) * [`context.waitForEvent`](../events/context-wait-for-event)