2.1.0 • Published 7 years ago

evee v2.1.0

Weekly downloads
71
License
MIT
Repository
github
Last release
7 years ago

GitHub license npm Travis

evee.js

The blazing fast ES6 event library.

Evee is a lightweight event library, written in clean ECMAScript6.
Evee exports both an ES5 and an ES6 version to support a wide range of clients.

How to upgrade from evee 1.x to evee 2.1.0+

From version 2.0.0, evee exports two entry points: evee and evee/es6.
The evee export is what you're used to, and will work with all ES5 compatible targets.
The evee/es6 export is the ES6 version of evee, which is generally faster.

If you wanna keep using the ES5 version, you don't need to change anything!
If you wanna upgrade to the beautiful ES6 version, here's how to do it:

// Importing evee/es6 (require)
const Evee = require('evee/es6'),
      evee = new Evee;

// Importing evee/es6 (ES6 modules)
import Evee from 'evee/es6';
const  evee = new Evee;

Status

The project is still actively maintained, but the functionality is complete.
Bugs will still be fixed and feature requests are more than welcome.

How to use

// Grab a new evee instance
const Evee = require('evee/es6'),
      evee = new Evee;

// Subscribe to the 'update' event
evee.on('update', e => console.log(`Ticks: ${e.data}`));

var ticks = 0;
while(true) {

  // Dispatch the 'update' event
  evee.emit('update', ++ticks);
}

You can also keep track of your event listeners unsubscribe from events you don't need anymore.

// Grab a new evee instance
const Evee = require('evee/es6'),
      evee = new Evee;

// Subscribe to the 'say' event
var receiver = evee.on('say', e => console.log(e.data));

// Dispatch the 'say' event
evee.emit('say', 'Hello, world!');

// Unsubscribe from the 'say' event
evee.drop(receiver);

If you want to fire an event only once, you can do that too!
The event will be automatically removed after the first usage:

// Grab a new evee instance
const Evee = require('evee/es6'),
      evee = new Evee;

// Subscribe to the 'say' event
evee.once('say', e => console.log('hello, world'));

// Dispatch the 'say' event two times
evee.signal('say');
evee.signal('say');

// hello, world is only printed once!

As you can see, evee is really easy to use!
Start using evee today and stop worrying about slow events :)

Running the benchmarks

$ git clone git@github.com:SplittyDev/evee.js.git
$ cd evee.js
$ npm install --only=dev
$ npm run-script bench-dev
2.1.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.6

8 years ago

0.8.5

8 years ago

0.8.4

8 years ago

0.8.3

8 years ago

0.8.2

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.1

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago