anchorbrowser
Version:
The official TypeScript library for the Anchorbrowser API
47 lines • 1.62 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Events = void 0;
const resource_1 = require("../core/resource.js");
const path_1 = require("../internal/utils/path.js");
class Events extends resource_1.APIResource {
/**
* Signals an event with associated data, unblocking any clients waiting for this
* event. This enables coordination between different browser sessions, workflows,
* or external processes.
*
* @example
* ```ts
* const successResponse = await client.events.signal(
* 'workflow_completed',
* {
* data: {
* message: 'bar',
* result: 'bar',
* timestamp: 'bar',
* },
* },
* );
* ```
*/
signal(eventName, body, options) {
return this._client.post((0, path_1.path) `/v1/events/${eventName}`, { body, ...options });
}
/**
* Waits for a specific event to be signaled by another process, workflow, or
* session. This endpoint blocks until the event is signaled or the timeout is
* reached. Useful for coordinating between multiple browser sessions or workflows.
*
* @example
* ```ts
* const response = await client.events.waitFor(
* 'workflow_completed',
* );
* ```
*/
waitFor(eventName, body = {}, options) {
return this._client.post((0, path_1.path) `/v1/events/${eventName}/wait`, { body, ...options });
}
}
exports.Events = Events;
//# sourceMappingURL=events.js.map
;