Skip to content

Instantly share code, notes, and snippets.

@neoGeneva
Created October 24, 2011 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save neoGeneva/1309070 to your computer and use it in GitHub Desktop.
Save neoGeneva/1309070 to your computer and use it in GitHub Desktop.
Simple Event Creator in JavaScript
var createEvent = function() {
var _handlers = [];
return function() {
if (arguments.length === 1 && typeof arguments[0] === 'function') {
_handlers.push(arguments[0]);
return;
}
for (var i = 0; i < _handlers.length; ++i) {
_handlers[i].apply(this, arguments);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment