Modules@robinpath/event

@robinpath/event

0.1.0Public

Pub/sub event emitter for RobinPath automation workflows

@robinpath/event

Pub/sub event system with named buses, listener management, history, and async waitFor

Category Functions Auth License

Why use this module?

The event module lets you:

  • Create a named event bus with an optional max listener limit
  • Subscribe a listener to an event on a named bus
  • Subscribe a one-time listener that automatically removes itself after firing
  • Remove a listener, all listeners for an event, or all listeners on the bus
  • Emit an event with optional data, notifying all subscribed listeners

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/event

Quick Start

No credentials needed — start using it right away:

event.on "workflow" "task.completed" $handler

Available Functions

FunctionDescription
event.createCreate a named event bus with an optional max listener limit
event.onSubscribe a listener to an event on a named bus
event.onceSubscribe a one-time listener that automatically removes itself after firing
event.offRemove a listener, all listeners for an event, or all listeners on the bus
event.emitEmit an event with optional data, notifying all subscribed listeners
event.listenerCountGet the number of listeners for a specific event or all events on a bus
event.eventNamesList all event names that have listeners on a bus
event.removeAllRemove all listeners from all events on a bus
event.historyGet the emission history for a bus, optionally filtered by event name
event.waitForWait for a specific event to be emitted, with a timeout
event.destroyDestroy a named event bus and free all resources

Examples

Subscribe a listener to an event on a named bus

event.on "workflow" "task.completed" $handler

Subscribe a one-time listener that automatically removes itself after firing

event.once "workflow" "done" $handler

Remove a listener, all listeners for an event, or all listeners on the bus

event.off "workflow" "task.completed"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/event";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  event.on "workflow" "task.completed" $handler
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/event
Version0.1.0
LicenseMIT
Unpacked Size5.5 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

devops