hassanzohdy/mongez-events/bus

Claude Code and agent skill by hassanzohdy/mongez-events

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Full API reference for the @mongez/events singleton — subscribe, trigger, triggerAll, async variants, inspect, and direct dispatch.

Install

npx vskill@latest install hassanzohdy/mongez-events/bus

SKILL.md

Events bus

The full API surface of the singleton events instance.

Subscribe

ts
events.subscribe(event: string, callback: Function): EventSubscription
events.on(event, callback): EventSubscription // alias
events.addEventListener(event, callback): EventSubscription // alias

Returns:

ts
type EventSubscription = {
callback: Function;
event: string;
dispatch(...args: any[]): any; // call the callback directly
unsubscribe(): void;
};

Hold the returned subscription and call unsubscribe() when you no longer want the callback.

Trigger

ts
events.trigger(event: string, ...args: any[]): any
events.emit(event, ...args): any // alias

Behavior:

  • Calls every callback registered for event in subscription order.
  • If a callback returns `false`, the chain stops and `trigger` returns `false`. Use this for "veto" patterns.
  • Otherwise the last non-undefined return value is returned.
ts
events.subscribe("save.before", (data) => {
if (!isValid(data)) return false; // vetoes the save
});
const ok = events.trigger("save.before", payload);
if (ok === false) return;

Trigger all (no short-circuit)

ts
events.triggerAll(event: string, ...args: any[]): EventTriggerResponse
type EventTriggerResponse = {
event: string;
length: number; // number of callbacks invoked
results: any[]; // all non-undefined return values
};

Use when you want every handler to run regardless of return values — analytics, multi-listener notifications, aggregations.

Async variants

ts
events.triggerAsync(event, ...args): Promise<any>
events.triggerAllAsync(event, ...args): Promise<EventTriggerResponse>

Callbacks are awaited in subscription order, not in parallel. If you need parallel dispatch, do it yourself:

ts
await Promise.all(
events.subscriptions("flush").map(s => s.dispatch(data)),
);

triggerAsync also honors the return false short-circuit (after awaiting the offending callback).

Inspect / unsubscribe

ts
events.subscriptions(event: string): EventSubscription[]
events.unsubscribe(event?: string): this // detach one event or all
events.off(event?: string): this // alias

Calling unsubscribe() with no argument wipes the whole bus. Useful in test teardown.

Direct dispatch (skip the bus)

The returned EventSubscription.dispatch(...args) invokes the callback directly without going through the trigger pipeline. Useful when you want to fire one specific listener without notifying the rest.

ts
const sub = events.subscribe("ping", (n) => n * 2);
sub.dispatch(21); // 42

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hassanzohdy/mongez-events/bus/badge)](https://verified-skill.com/skills/hassanzohdy/mongez-events/bus)

Something wrong with this skill or its page? Tell us.