1. @antv/event-emitter
event emitter for antvis.
@antv/event-emitter
Package: @antv/event-emitter
Created by: antvis
Last modified: Sun, 28 Apr 2024 08:59:19 GMT
Version: 0.1.3
License: MIT
Downloads: 578,342
Repository: https://github.com/antvis/event-emitter

Install

npm install @antv/event-emitter
yarn add @antv/event-emitter

@antv/event-emitter

event-emitter for @antvis.

Install

npm i --save @antv/event-emitter

Usage

 import EE from '@antv/event-emitter';

const ee = new EE();

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

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

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

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

ee.off('click');

API

Simple and similar with event-emitter.

  • on(evt: string, callback: Function): listen an event.
  • once(evt: string, callback: Function): listen a event only once.
  • emit(evt: string, ...parameters: any[]): emit / trigger an event with parameters.
  • off(evt?: string, callback?: Function): unsubscribe an event.
  • getEvents(): get all the exist events.

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