Skip to content

A minor extension to EventEmitter to allow ordering event listeners

License

Notifications You must be signed in to change notification settings

jdpanderson/OrderedEventEmitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OrderedEventEmitter

A minor extension to EventEmitter to allow ordering event listeners

var OrderedEventEmitter = require('OrderedEventEmitter');

// Should match new EventEmitter() - no args accepted
var emitter = new OrderedEventEmitter();

var inherits = emitter instanceof EventEmitter; // True

// All the expected stuff hooks in to the parent.
emitter.on('something', function() { console.log('something happened'); });

// ... Except you can shove a listener to the head of the queue.
emitter.addListenerFirst('something', function() { console.log('something first!'); });

About

A minor extension to EventEmitter to allow ordering event listeners

Resources

License

Stars

Watchers

Forks

Packages

No packages published