API Reference
mitt
Tiny 200b event emitter library for JavaScript with no dependencies and clean API.
Official Documentation ↗CompatibilityThis documentation covers version
v3.0.1. Check the official docs for the latest API surface.Installation
npm
npm install mittpnpm
pnpm add mittMethods
No methods match this filter.
mitt is tiny 200b event emitter library for JavaScript with no dependencies and clean API.
Key Features
- data-fetching: Designed for data fetching scenarios with a focused API surface.
Installation
npm install mitt
Usage
API reference evidence
Fetched from official sources on 2026-11-08T18:20:00+08:00 via WebFetch https://raw.githubusercontent.com/developit/mitt/main/src/index.ts;WebFetch https://raw.githubusercontent.com/developit/mitt/main/README.md.
mitt.on→ signature from https://raw.githubusercontent.com/developit/mitt/main/src/index.ts; official text: “on(type: Key, handler: Handler<Events[Key]>): void;” mitt.off→ signature from https://raw.githubusercontent.com/developit/mitt/main/src/index.ts; official text: “off( type: Key, handler?: Handler<Events[Key]> ): void;” mitt.emit→ signature from https://raw.githubusercontent.com/developit/mitt/main/src/index.ts; official text: “emit(type: Key, event: Events[Key]): void;”
FAQ
- Is mitt synchronous?
- Yes, event emission and handler invocation are synchronous. Handlers run in registration order.
- Can I remove all listeners for one event type?
- Yes, call off(type) without a handler, or use clear() to remove all listeners across all types.
- Does mitt support wildcard events?
- Most minimal emitters require exact type matching. Check the official docs for wildcard or glob support.
Report a problem with this API docOpens a pre-filled issue on GitHub.