mysticatea / Event Target Shim
Licence: mit
An implementation of WHATWG EventTarget interface, plus few extensions.
Stars: ✭ 89
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Projects that are alternatives of or similar to Event Target Shim
Rando.js
The world's easiest, most powerful random function.
Stars: ✭ 659 (+640.45%)
Mutual labels: npm, npm-package, npm-module
Awesome Node Utils
some useful npm packages for nodejs itself
Stars: ✭ 51 (-42.7%)
Mutual labels: npm, npm-package, npm-module
Jsonexport
{} → 📄 it's easy to convert JSON to CSV
Stars: ✭ 208 (+133.71%)
Mutual labels: npm, npm-package, npm-module
Homebridge Wol
A Wake on Lan plugin for Homebridge
Stars: ✭ 150 (+68.54%)
Mutual labels: npm, npm-package, npm-module
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+2119.1%)
Mutual labels: npm, npm-package, npm-module
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+185.39%)
Mutual labels: npm, npm-package, npm-module
Ts ci
✅ Continuous integration setup for TypeScript projects via GitHub Actions.
Stars: ✭ 225 (+152.81%)
Mutual labels: npm, npm-package, npm-module
Cpx
A cli tool to watch and copy file globs.
Stars: ✭ 394 (+342.7%)
Mutual labels: npm, npm-package, npm-module
Eslint Plugin Vue
Official ESLint plugin for Vue.js
Stars: ✭ 3,592 (+3935.96%)
Mutual labels: npm, npm-package, npm-module
Eslint Plugin Node
Additional ESLint's rules for Node.js
Stars: ✭ 740 (+731.46%)
Mutual labels: npm, npm-package, npm-module
Webcam Easy
javascript access webcam stream and take photo
Stars: ✭ 79 (-11.24%)
Mutual labels: npm, npm-package, npm-module
React Ckeditor
CKEditor component for React with plugin and custom event listeners support
Stars: ✭ 124 (+39.33%)
Mutual labels: npm, npm-package, npm-module
Darkmode.js
🌓 Add a dark-mode / night-mode to your website in a few seconds
Stars: ✭ 2,339 (+2528.09%)
Mutual labels: npm, npm-package, npm-module
Tplink Cloud Api
A node.js npm module to remotely control TP-Link smartplugs (HS100, HS110) and smartbulbs (LB100, LB110, LB120, LB130) using their cloud web service (no need to be on the same wifi/lan)
Stars: ✭ 96 (+7.87%)
Mutual labels: npm, npm-package, npm-module
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (+187.64%)
Mutual labels: npm, npm-package, npm-module
Npm Run All
A CLI tool to run multiple npm-scripts in parallel or sequential.
Stars: ✭ 4,496 (+4951.69%)
Mutual labels: npm, npm-package, npm-module
Packagephobia
⚖️ Find the cost of adding a new dependency to your project
Stars: ✭ 1,110 (+1147.19%)
Mutual labels: npm, npm-package, npm-module
Yarpm
CLI tool to run npm scripts with either npm or yarn, depending on how it was started
Stars: ✭ 13 (-85.39%)
Mutual labels: npm, npm-package
event-target-shim
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.
Native Support Information:
Feature | IE | Edge | Firefox | Chrome | Safari | Node.js |
---|---|---|---|---|---|---|
Event constructor |
❌ | 12 | 11 | 15 | 6 | 15.4.0 |
EventTarget constructor |
❌ | 87 | 84 | 87 | 14 | 15.4.0 |
passive option |
❌ | 16 | 49 | 51 | 10 | 15.4.0 |
once option |
❌ | 16 | 50 | 55 | 10 | 15.4.0 |
signal option |
❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
💿 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, there are two ways:
- 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. - use CDN such as
unpkg.com
. For example,<script src="https://unpkg.com/[email protected]"></script>
will defineEventTargetShim
global variable.
- use a bundler such as Webpack to bundle. If you want to support IE11, use
- The
AbortController
class was added to the standard on 14 Jul 2017. If you want the shim of that, use abort-controller package.
Runnable Examples
📚 API Reference
See docs/reference.md.
💥 Migrating to v6
📰 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.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].