stacks-events

Dispatch and listen to events in a Stacks application with a mitt-based emitter.

622|17|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/stacksjs/stacks --skill stacks-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-events
Source: https://github.com/stacksjs/stacks/tree/main/.claude/skills/stacks-events
Command: npx skills add https://github.com/stacksjs/stacks --skill stacks-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dispatch and listen to events in a Stacks application, enabling clean, decoupled communication between components, models, and actions.

Core Features & Use Cases

  • Tiny, Mitt-based event emitter that exposes dispatch/listen/off/emitter and wildcard support.
  • Integrates with app/Events.ts and app/Listener.ts to drive action-based event resolution.
  • Supports model events when models are observed, and provides a consistent event flow across frontend, API, and background tasks.

Quick Start

Import the Stacks event module and start emitting and listening for events in your code.

Frequently Asked Questions about stacks-events

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

FAQPage Schema
How do I dispatch and listen to events in a Stacks application?

To dispatch and listen to events in a Stacks application, you use a lightweight mitt-based emitter that exposes dispatch and listen helpers for clean, decoupled communication between components, models, and actions.

Can I use model events with a TypeScript event emitter?

Yes, model events are supported when models are observed. The emitter integrates with app/Events.ts and app/Listener.ts to drive action-based event resolution and provide type-safe event routing.

What's the best way to handle event routing across frontend and API tasks?

The best way to handle event routing across frontend, API, and background tasks is using a lightweight mitt-based emitter that provides a consistent event flow and type-safe routing via app/Listener.ts.

Does the Stacks event emitter support wildcard listeners?

Yes, the Stacks event emitter supports wildcard listeners. It exposes dispatch, listen, off, and emitter functionalities to enable flexible event handling across your application.

How do I decouple component communication using event listeners?

You can decouple component communication by importing the Stacks event module to emit and listen for events. This enables clean separation between components, models, and actions without direct dependencies.

Why do I need app/Events.ts and app/Listener.ts for type-safe event handling?

You need app/Events.ts and app/Listener.ts to achieve type-safe event routing. These files drive action-based event resolution and ensure consistent event flow across frontend, API, and background tasks.