Skip to content

Instantly share code, notes, and snippets.

@ericelliott
Created May 28, 2016 03:33
Show Gist options
  • Save ericelliott/39db4e0ee715f8b73b0358649a3b31b1 to your computer and use it in GitHub Desktop.
Save ericelliott/39db4e0ee715f8b73b0358649a3b31b1 to your computer and use it in GitHub Desktop.
Event emitter mixin for ES6
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