# developit/mitt

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/developit-mitt).**

11,872 stars · 483 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/developit/mitt
- Homepage: https://npm.im/mitt
- awesome-repositories: https://awesome-repositories.com/repository/developit-mitt.md

## Topics

`event` `event-bus` `event-handlers` `event-listener` `eventemitter` `mitt` `pubsub` `tiny`

## Description

Mitt is a lightweight event emitter and publish-subscribe messaging library designed for managing communication between decoupled components. It provides a minimal utility for registering, dispatching, and removing event listeners within browser and Node.js environments.

The library distinguishes itself through a functional interface that maintains a small memory footprint by using function references for listener management. It supports wildcard pattern matching, allowing a single handler to respond to all emitted events, and executes callbacks synchronously to ensure predictable state updates.

These capabilities facilitate the implementation of extensible plugin architectures and the synchronization of application state across various UI elements. The system is distributed as a compact utility that handles event lifecycles through a shared state object and a hash map registry.

## Tags

### Development Tools & Productivity

- [Event Emitters](https://awesome-repositories.com/f/development-tools-productivity/event-emitters.md) — Provides a tiny library for managing event-driven communication using a simple publish-subscribe pattern.

### Software Engineering & Architecture

- [Event Driven Messaging](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-messaging.md) — Decouples application logic by broadcasting data payloads to registered event listeners.
- [Event Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/event-dispatchers.md) — Routes application events to registered listeners, passing optional data payloads to each. ([source](https://github.com/developit/mitt#readme))
- [Event Listeners](https://awesome-repositories.com/f/software-engineering-architecture/event-listeners.md) — Implements a hash map registry to store and manage event listeners for decoupled component communication.
- [Wildcard Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/pattern-matching-libraries/wildcard-dispatchers.md) — Supports a special event key that triggers all registered listeners regardless of the specific event name.
- [Application Plugins](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/application-plugins.md) — Facilitates extensible plugin architectures by allowing modules to hook into core lifecycle events.
- [Synchronous Execution Hooks](https://awesome-repositories.com/f/software-engineering-architecture/reactive-update-scheduling/post-update-callbacks/synchronous-execution-hooks.md) — Ensures predictable state updates by executing event listeners synchronously.

### User Interface & Experience

- [Lightweight Pub-Sub Managers](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/event-handling-systems/cross-browser-event-managers/lightweight-pub-sub-managers.md) — Implements a lightweight pub-sub pattern to coordinate communication between decoupled components.
- [State-Synchronized Bindings](https://awesome-repositories.com/f/user-interface-experience/data-binding-frameworks/state-synchronized-bindings.md) — Enables synchronization of application state across various UI elements through event-driven updates.

### Part of an Awesome List

- [Event Emitters](https://awesome-repositories.com/f/awesome-lists/devtools/event-emitters.md) — Tiny event emitter for general purpose messaging.

### Web Development

- [Event Listeners](https://awesome-repositories.com/f/web-development/event-listeners.md) — Allows developers to subscribe functions to specific event types or wildcard patterns. ([source](https://github.com/developit/mitt#readme))
- [Event Listener Managers](https://awesome-repositories.com/f/web-development/event-listener-managers.md) — Provides a lightweight mechanism for managing the lifecycle of event listeners through function references.
- [JavaScript Utility Libraries](https://awesome-repositories.com/f/web-development/javascript-utility-libraries.md) — Acts as a minimal utility library for event registration, dispatching, and cleanup in JavaScript environments.
