1. onfire.js
onfire.js is a mini (~500 b) version for event-emitter.
onfire.js
Package: onfire.js
Created by: hustcc
Last modified: Wed, 22 Jun 2022 22:16:05 GMT
Version: 2.0.1
License: MIT
Downloads: 372
Repository: https://github.com/hustcc/onfire.js

Install

npm install onfire.js
yarn add onfire.js

onfire.js

nano version (~ 500b) for event-emitter.

Build Status
npm

中文文档 | English Doc

Install

npm i --save onfire.js

Usage

 import EE from 'onfire.js';

const ee = new EE();

ee.on('mouseover', () => {});

ee.once('click', () => {});

ee.fire('click', 1, 'hello', true);

ee.off('click');

API

Simple and similar with event-emitter.

  • on(eventName: string, callback: Function): listen an event.
  • once(eventName: string, callback: Function): listen a event only once.
  • fire(eventName: string, ...parameters: any[]): emit / trigger an event with parameters.
  • off(eventName?: string, callback?: Function): unsubscribe an event.

Used

  • Events subscribe and dispatcher.
  • Cross-component communication for React / Vue / Angular.
  • System event mechanism.

License

MIT@hustcc.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin