Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
Created November 28, 2013 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgvashworth/7685685 to your computer and use it in GitHub Desktop.
Save tgvashworth/7685685 to your computer and use it in GitHub Desktop.
> var events = require('events');
undefined
> var ee = new events.EventEmitter();
undefined
> var thing1 = Object.create(ee);
undefined
> var thing2 = Object.create(ee);
undefined
> thing1.on('fish', console.log.bind(console, 'thing1'));
{}
> thing2.emit('fish', 'hello from thing2');
thing1 hello from thing2
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment