using-eventize

Provide a zero-dependency synchronous event emitter API for JavaScript and TypeScript objects.

3|Updated Feb 11, 2016
One-click install
npx skills add https://github.com/spearwolf/eventize --skill using-eventize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-eventize
Source: https://github.com/spearwolf/eventize/tree/main/skills/using-eventize
Command: npx skills add https://github.com/spearwolf/eventize --skill using-eventize

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building robust event-driven code can be error-prone without a lightweight, predictable emitter. The Skill provides a zero-dependency, synchronous event-emitter API for JS/TS objects, supporting on/emit flows, priorities, and retention events, to simplify real-time patterns.

Core Features & Use Cases

  • Lightweight, zero-dependency event emitter that works with plain objects, with functional, injected, or class-based usage.
  • Supports on/once/emit/emitAsync, retain semantics, event priorities, and wildcard listeners for flexible event routing.
  • Real-world use: orchestrate immediate reactions in games or UI loops, or coordinate modules within a cohesive, synchronous event flow.

Quick Start

Create an emitter on a plain object with eventize(obj), subscribe to events with on(), and emit events with emit() to trigger listeners.

Frequently Asked Questions about using-eventize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a synchronous event emitter to a plain TypeScript object?

To add a synchronous event emitter to a TypeScript object, use the eventize(obj) function. This zero-dependency API enables on/emit flows directly on plain objects, supporting functional, injected, or class-based patterns without altering core structures.

Can I prioritize specific event listeners in a synchronous event flow?

Yes, you can prioritize specific event listeners in a synchronous event flow. The eventize API supports event priorities, allowing you to orchestrate immediate reactions by controlling the execution order of listeners triggered during the emit process.

What is event retention in a synchronous event emitter?

Event retention in a synchronous event emitter is a mechanism that stores emitted events. This retain semantic ensures newly added listeners immediately receive previously emitted events, simplifying state synchronization in real-time applications.

Does eventize support wildcard listeners for event routing?

Yes, eventize supports wildcard listeners for flexible event routing. You can use wildcards to subscribe to multiple event types simultaneously, capturing broad event streams within your synchronous JavaScript or TypeScript modules.

How do I ensure type safety for event payloads in TypeScript?

To ensure type safety for event payloads in TypeScript, use the generic eventize<T>() API. This method enforces strict type checking on emitted events and listener callbacks, preventing runtime type errors in your event-driven code.

Can I emit asynchronous events with a synchronous event emitter?

Yes, you can emit asynchronous events using the emitAsync function. While the core eventize API is synchronous for real-time orchestration, emitAsync provides an asynchronous flow for events that require deferred execution.