yzk-eventful

1.0.4 • Public • Published

Intro

Simple、Lightful、Efficient event library. only 966 bytes.

Quick start

1、install

npm install yzk-eventful

2、usage example

import { Eventful } from 'yzk-eventful';


class A extends Eventful {
    constructor() {
        super();
        this.test();
    }

    test() {
        setInterval(() => {
            // dispatchEvent
            this.dispatchEvent('click', 1);
        }, 3000);
    }

}

const instance = new A();
let func = (event) => {
    console.log(event);
};
// addEventListener
instance.addEventListener('click', func);

// hasEventListener
let exist = instance.hasEventListener('click', func);

// removeEventListener
let success = instance.removeEventListener('click', func);

Readme

Keywords

Package Sidebar

Install

npm i yzk-eventful

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

10.7 kB

Total Files

6

Last publish

Collaborators

  • yuanzk