Skip to content

Instantly share code, notes, and snippets.

@zxqx
Created February 2, 2015 23:18
Show Gist options
  • Save zxqx/ebcc00dbf592ef417431 to your computer and use it in GitHub Desktop.
Save zxqx/ebcc00dbf592ef417431 to your computer and use it in GitHub Desktop.
module.exports = Messenger;
/**
* Event messenger
* @constructor
*/
function Messenger()
{
}
Messenger.prototype.trigger = function(method, args)
{
this[method](args);
};
Messenger.prototype.on = function(context, event, callback)
{
this[event] = callback.bind(context);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment