NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #757 most downloaded on npm
An implementation of WHATWG EventTarget interface.
Last release 6 years ago
no release in 18 months
Release timing varies
gaps range from 8 days to 1.9 years
Most releases are documented
notes for 19 of 26 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
27 releases · first in 2015
This version fixed event-target-shim/es5 and event-target-shim/umd exported files for working well on IE11.
This version fixed event-target-shim/es5 and event-target-shim/umd exported files for working well on IE11.
❌ This is an accidental broken release ❌
❌ This is an accidental broken release ❌
v6.0.1
Compare
One column per quarter.
API has some breaking changes. See Migration Guide for details.
This package has been rewritten with TypeScript.
API has some breaking changes.
See Migration Guide for details.
Event class is availablePreviously, 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 availableIt'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();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.
});6218530 fixed the bug that the transpiled .umd.js file is using ES2015 syntax.
.umd.js file is using ES2015 syntax.This release affects only type definitions for TypeScript but doesn't change any implementation.
This release affects only type definitions for TypeScript but doesn't change any implementation.
77fb6209...a3774a59 changed type definition. In new definition, we can specify arbitary Event type for each event with type parameters. It generate specialized types for addEventListener, removeEventListener, dispatchEvent, and event attributes such as onclick. See also https://github.com/mysticatea/event-target-shim#typescriptNothing published for this version
77fb620 fixed a bug that it used ES2018 syntax which Node.js 6.x doesn't support.
bc69ef4 fixed a bug in the type definition.
1d4f242 and 7b8d773 fixed some problems in type definitions.
The notable change is that this package gets including the TypeScript type definition 🎉
The notable change is that this package gets including the TypeScript type definition 🎉
EventTarget#addEventListener and EventTarget#removeEventListener.Event wrapper: srcElement, cancelBubble, returnValue, and initEvent. Those exist for historical reason.db03dcc6d57299b26090cac5e937ea3fe0c8ba9e fixed an invalid field in package.json.
EventTarget stops event dispatching if a listener threw an exception.d404ca16a50130c6758c5ee7e8b4619b6bccbfab fixed a bug that infinite recursive calls happen on IE when this is invalid value.
this is invalid value. (#12)04b0a202472c0442230371017da9a6383c2441d1 changed event wrappers. It had been creating an object which has the original event object as its prototype,
prototype, to override methods such as event.preventDefault in order to manage internal state. Now it defines wrapper classes for each event classes.IE <=10, Node.js <4.0.0).defineEventAttribute(proto, type) to public API. This function defines an event attribute (e.g. obj.onclick) to a given prototype object..mjs) experimentally.import EventTarget from "event-target-shim" with node --experimental-modules switch imports dist/event-target-shim.mjs file.event-target-shim with rollup.js (I had used browserify before).Now, once and passive options are supported.
Now, once and passive options are supported.
obj.addEventListener("test", listener, {capture: true, once: true, passive: true})
WHATWG EventTarget Interface is supporting those options.
once option was specified, the listener will be removed on called.passive option was specified, it cannot use event.preventDefault() method in the listener.Please mind that this might change the behavior if you have been giving an object to useCapture option before. It has been handling objects as truthy for useCapture flag on v1. However, it uses options.capture property for useCapture flag on v2. Of course, if the option value is a boolean value then it's the same behavior as v1.
obj.addEventListener("test", listener, true)
More compatibility with well-known browsers.
More compatibility with well-known browsers.
addEventListener accepts an object.dispatchEvent calls handleEvent method if a listener is not a function.null.Thank you @nickdesaulniers!
The function EventTarget comes to accept an array of string (#3). This is convenience than the variadic function in order to define many event's types
Enhancement:
EventTarget comes to accept an array of string (#3).
This is convenience than the variadic function in order to define many event's types.Nothing published for this version
- Stop using Babel. - Improve test coverage. - Update devDependencies.
Fix: it should be possible to use the CustomEvent's detail property. (#1).
CustomEvent's detail property. (#1).
Upgraded power-assert, Babel 5.x was supported.
power-assert, Babel 5.x was supported.Nothing published for this version
Nothing published for this version
the files are for AMD. And did refactoring.
the files are for AMD.
And did refactoring.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →