Created
May 28, 2016 03:33
-
-
Save ericelliott/39db4e0ee715f8b73b0358649a3b31b1 to your computer and use it in GitHub Desktop.
Event emitter mixin for ES6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Events from 'eventemitter3'; | |
const object = {}; | |
Object.assign(object, Events.prototype); | |
object.on('event', payload => console.log(payload)); | |
object.emit('event', 'some data'); // 'some data' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment