Skip to content

Instantly share code, notes, and snippets.

@leetreveil
Created November 9, 2010 16:11
Show Gist options
  • Save leetreveil/669300 to your computer and use it in GitHub Desktop.
Save leetreveil/669300 to your computer and use it in GitHub Desktop.
Takes an internal event and re-emits it as the parent and with an alias.
processor.emit = function() {
var event = arguments[0];
var value = arguments[1];
//emit original event
self.emit(event, value);
//rewrite to new alias
for(var i in MAPPINGS){
var current = MAPPINGS[i];
if(current.from.indexOf(event) > -1){
self.emit(current.to, value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment