Back to Explore

open-draft/strict-event-emitter

GitHub
1 watchersOpen source

Last release: 9/21/2023

Type-safe EventEmitter implementation for browser and Node.js, designed for event-driven architectures that need strict event contracts. It lets you define allowed event names and the argument payload types, so invalid event names or payloads are rejected at runtime with TypeError. Useful when you want safer event handling than the native Node.js EventEmitter type definitions.

Project status

  • The repo appears to have had recent activity (last upstream push on 2024-08-06), but the most recent tagged update listed is v0.5.1 dated 2023-09-21, so it is not clearly keeping a steady public update cadence.
  • Apparent update cadence based on the provided tags is sporadic: v0.4.6 (2023-02-05), v0.5.0 (2023-03-21), and v0.5.1 (2023-09-21). After v0.5.1, no further tagged update details are shown.

AI summary generated Today

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v0.5.1

    9/21/2023

    v0.5.1 focuses on fixing issues with the emitter .once() behavior, specifically around async listeners and multiple once listeners registered for the same event name. The runtime fix is implemented in src/Emitter.ts, and a new unit test was added to cover the same-event once scenario.

  • v0.5.0

    3/21/2023

    v0.5.0 switches the package distribution to include ESM output. The code diff also shows significant changes to packaging and build tooling (tsup, exports map), plus CI and release automation updates to use pnpm and Node 18.

    Features
  • v0.4.6

    2/5/2023

    v0.4.6 primarily changes the TypeScript compilation target to ES6, aligning the build output with the stated release note. The code diff also includes small internal refactoring in Emitter and documentation-only example/typo corrections.

  • v0.4.4

    1/20/2023

    v0.4.4 is a small change focused on the Emitter implementation internals. It switches the Emitter's internal fields and helper methods from JavaScript class-private members (#...) to TypeScript private members (private ... and private methods prefixed with _).

  • v0.4.3

    12/21/2022

    v0.4.3 is a very small release focused on TypeScript import typing syntax. The only functional-looking change is in MemoryLeakError.ts, where the project switches to a `import type { ... }` form for the Emitter type, and the package.json version is bumped to 0.4.3.

  • v0.4.2

    12/21/2022

    v0.4.2 includes a single bug fix related to how the emitter enforces max listeners. The code change ensures that setting the max listeners to 0 is treated as having no limit, matching the release notes.

  • v0.4.1

    12/21/2022

    v0.4.1 updates the type-safe Emitter so consumers can register listeners for internal events newListener and removeListener. The release notes describe this as a bug fix, and the code diff shows substantial TypeScript API surface changes to support those internal event names across multiple Emitter methods.

    Features
  • v0.4.0

    12/21/2022

    Release v0.4.0 removes the type-safe StrictEventEmitter and StrictEventTarget APIs from the package entrypoint. The implementation files, their tests, and related type exports are deleted, and the Node dependency on the `events` package is also removed.

    Breaking
  • v0.3.2

    12/21/2022

    v0.3.2 adds an environment-agnostic EventEmitter implementation (new Emitter class) alongside the existing strict emitter utilities. The release notes mention this “Emitter” change, but the diff shows additional runtime behavior (like max listener warning) and new exports that are not described.

    Features
  • v0.3.1

    12/20/2022

    v0.3.1 is a small update focused on TypeScript type-safety around the `StrictMessageEvent` generic typing. The release notes mention adding support for the `Type` generic, and the actual diff shows additional changes to listener and event method type signatures.