package
An implementation of WHATWG EventTarget interface.
npm install event-target-shimGitHub-flavored package documentation.
Across all versions, last 30 days.
386,558,843 in 30 days
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
7.4 kB
Includes dependencies.
An implementation of WHATWG EventTarget interface and WHATWG Event interface. This implementation supports constructor, passive, once, and signal.
This implementation is designed ...
Use npm or a compatible tool.
npm install event-target-shimimport { EventTarget, Event } from "event-target-shim";
// constructor (was added to the standard on 8 Jul 2017)
const myNode = new EventTarget();
// passive flag (was added to the standard on 6 Jan 2016)
myNode.addEventListener(
"hello",
(e) => {
e.preventDefault(); // ignored and print warning on console.
},
{ passive: true }
);
// once flag (was added to the standard on 15 Apr 2016)
myNode.addEventListener("hello", listener, { once: true });
myNode.dispatchEvent(new Event("hello")); // remove the listener after call.
import {} from "event-target-shim/es5" instead. It's a transpiled code by babel. It depends on @baebl/runtime (^7.12.0) package.AbortController class was added to the standard on 14 Jul 2017. If you want the shim of that, use abort-controller package.See docs/reference.md.
See GitHub releases.
Contributing is welcome ❤️
Please use GitHub issues/PRs.
npm install installs dependencies for development.npm test runs tests and measures code coverage.npm run watch:mocha runs tests on each file change.