Releases: mysticatea/event-target-shim
v6.0.2
v6.0.1
❌ This is an accidental broken release ❌
v6.0.0
This package has been rewritten with TypeScript.
💥 Breaking Changes
API has some breaking changes.
See Migration Guide for details.
✨ New Features
■ Event
class is available
Previously, this package had not exported Event
class as prefers using the native Event
class. Since this version, this package exports it.
import { EventTarget, Event } from "event-target-shim";
const target = new EventTarget();
target.dispatchEvent(new Event("foo"));
■ signal
option on EventTarget.prototype.addEventListener
is available
It's a new feature that was added to the standard recently: whatwg/dom#919
import { EventTarget, Event } from "event-target-shim";
import { AbortController } from "abort-controller";
const target = new EventTarget();
const ac = new AbortController();
target.addEventListener("foo", listener, { signal: ac.signal });
// Remove the listener
ac.abort();
■ Customizing error/warning handling
Since this version, if a listener threw an exception, it causes the uncaughtException
event on Node.js or the error
event on window
. Also, if an operation was ignored silently, it prints warnings with console.warn
.
You can customize this behavior.
import { setErrorHandler, setWarningHandler } from "event-target-shim";
setErrorHandler((error) => {
// Do something.
});
setWarningHandler((warning) => {
// Do something.
});
v5.0.1
v5.0.0
This release affects only type definitions for TypeScript but doesn't change any implementation.
Breaking changes
77fb6209...a3774a59
changed type definition. In new definition, we can specify arbitaryEvent
type for each event with type parameters. It generate specialized types foraddEventListener
,removeEventListener
,dispatchEvent
, and event attributes such asonclick
. See also https://github.com/mysticatea/event-target-shim#typescript
v4.0.3
v4.0.2
v4.0.1
v4.0.0
The notable change is that this package gets including the TypeScript type definition 🎉
💥 Breaking changes
- 9557cbd dropped Node.js 4.x support. It has been EOL since April 2017.
- 66429d0 added the TypeScript type definition. It might be impact for people is using this package with TypeScript.
- 91df0db removed the undocumented return values from
EventTarget#addEventListener
andEventTarget#removeEventListener
.
✨ Enhancements
- ff21937 added some lacking members to our
Event
wrapper:srcElement
,cancelBubble
,returnValue
, andinitEvent
. Those exist for historical reason.