Skip to content

Instantly share code, notes, and snippets.

@HendrikRoth
Forked from barneycarroll/multi.js
Last active August 29, 2015 14:20
Show Gist options
  • Save HendrikRoth/6a07fdd20ffcdd0e2d91 to your computer and use it in GitHub Desktop.
Save HendrikRoth/6a07fdd20ffcdd0e2d91 to your computer and use it in GitHub Desktop.
var slice = Array.prototype.slice;
function multi(){
var handlers = slice.call( arguments );
return function execute(){
var args = slice.call( arguments );
var ctxt = this;
handlers.map( function applyCtxt( fn ){
if( fn instanceof Function ) fn.apply( ctxt, args );
} );
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment