Skip to content

Namespaced global event emitter.

License

Notifications You must be signed in to change notification settings

gulpjs/sparkles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sparkles

Build Status

Namespaced global event emitter

Usage

Sparkles exports a function that returns a singleton EventEmitter. This EE can be shared across your application, whether or not node loads multiple copies.

var sparkles = require('sparkles')(); // make sure to call the function

sparkles.on('my-event', function(evt){
  console.log('my-event handled', evt);
});

sparkles.emit('my-event', { my: 'event' });

Why the name?

This is a "global emitter"; shortened: "glitter" but it was already taken; so we got sparkles instead 😄

License

MIT