Releases: maxherrmann/jaset
Releases · maxherrmann/jaset
2.0.0
🚨 Breaking changes
Stricter type checking
emit() and dispatchEvent() are now strictly typed to the provided EventMap. Dispatching an event whose type or shape is not declared in the EventMap now throws a TypeScript error. Previously any Event was accepted.
Improved muting behavior
Muting is now independent of listeners and persists when a type has no listeners. mute("*") now mutes all current and future events, including types with no listeners yet. mute("*") also no longer populates mutedEventTypes.
Clearing event listeners
clear() no longer accepts an options parameter. It now removes all listeners for a type regardless of the options they were added with.
🚀 Features
Options support for wildcard event type
- The wildcard event type (
"*") now supports theonce,capture, andsignaloptions.
✨ Enhancements
- Improved type strictness across the whole Jaset interface.
- Wildcard listeners are now dispatched through the native
EventTarget, so they observe the correctcurrentTargetandeventPhase. mutedEventTypesis now aReadonlySetinstead of a mutableSet.- The
eventListenersmap now accurately reports listener objects instead of casting them to functions.
✅ Bug fixes
- Fixed:
emit()anddispatchEvent()could accept anyEventinstead of only events declared in the providedEventMap. - Fixed:
clear()did not remove capturing listeners. - Fixed: Throwing wildcard listeners aborted remaining listeners and pending emits.
- Fixed:
oncelisteners were not being cleaned up properly, which could lead to memory leaks. - Fixed: Using
AbortSignalcould lead to staleeventListenersentries and block re-registration after abort. - Fixed:
captureflag was being ignored when de-duplicating and removing listeners, which was different to the nativeEventTarget.
🔄 Refactoring
- Rewrote the internal listener store to track each listener’s native wrapper, capture flag, and abort cleanup, keyed by callback and capture.
- Renamed the internal
EventListenertype toEventListenerFnto stop shadowing the global DOMEventListenertype. - Reduced internal
as nevercasts. - Migrated the build process from
esbuildanddts-bundle-generatortotsdown.
Other
- Added tests.
- Updated dependencies.
- Updated documentation.
- Improved
package.jsonby addingsideEffectsandengineconfiguration. - Updated to ESLint 10.
- Updated to TypeScript 6.
- Set up additional linting with
attw(for packaged types) andpublint(for the NPM packge). - Improved the “Build and Publish” workflow.
- Added a “CI” workflow that runs on every push and PR to
main.
1.1.0
Initial release