Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

event-target-shim

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Issues
File Explorer

Advanced tools

event-target-shim

An implementation of WHATWG EventTarget interface.

    6.0.2latest

Version published
Maintainers
1
Weekly downloads
8,540,281
decreased by-13.03%

Weekly downloads

Changelog

Source

🐛 Bug Fixes

This version fixed event-target-shim/es5 and event-target-shim/umd exported files for working well on IE11.

Readme

Source

event-target-shim

npm version Downloads/month Build Status Coverage Status Dependency Status

An implementation of WHATWG EventTarget interface and WHATWG Event interface. This implementation supports constructor, passive, once, and signal.

This implementation is designed ...

  • Working fine on both browsers and Node.js.
  • TypeScript friendly.

💿 Installation

Use npm or a compatible tool.

npm install event-target-shim

📖 Getting started

import { 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. // signal (was added to the standard on 4 Dec 2020) const ac = new AbortController(); myNode.addEventListener("hello", listener, { signal: ac.signal }); ac.abort(); // remove the listener.
  • For browsers, use a bundler such as Webpack to bundle.
    • If you want to support IE11, use import {} from "event-target-shim/es5" instead. It's a transpiled code by babel. It depends on @baebl/runtime (^7.12.0) package.
  • The AbortController class was added to the standard on 14 Jul 2017. If you want the shim of that, use abort-controller package.

📚 API Reference

See docs/reference.md.

💥 Migrating to v6

See docs/migrating-to-v6.md.

📰 Changelog

See GitHub releases.

🍻 Contributing

Contributing is welcome ❤️

Please use GitHub issues/PRs.

Development tools

  • npm install installs dependencies for development.
  • npm test runs tests and measures code coverage.
  • npm run watch:mocha runs tests on each file change.

Keywords

FAQs

What is event-target-shim?

An implementation of WHATWG EventTarget interface.

Is event-target-shim popular?

The npm package event-target-shim receives a total of 6,913,318 weekly downloads. As such, event-target-shim popularity was classified as popular.

Is event-target-shim well maintained?

We found that event-target-shim demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 07 Jan 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc