Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson committed Feb 15, 2020
1 parent a256472 commit 9d70e68
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions readme.md
Expand Up @@ -23,17 +23,29 @@ const Emittery = require('emittery');

const emitter = new Emittery();

const myEvent = Symbol('my symbol event');

emitter.on('πŸ¦„', data => {
console.log(data);
// '🌈'
console.log(data); // '🌈'
});

emitter.on(myEvent, data => {
console.log(data); // 'πŸ¦‹'
});

emitter.emit('πŸ¦„', '🌈');
emitter.emit(myEvent, 'πŸ¦‹')

```


## API

### eventName

Emittery accepts strings and symbols as event names.
Symbol event names can be used to avoid name collisions when your classes are extended, especially for internal events.

### emitter = new Emittery()

#### on(eventName, listener)
Expand Down

0 comments on commit 9d70e68

Please sign in to comment.