Last active
August 29, 2015 14:10
-
-
Save madeingnecca/63732ab6d12082d02684 to your computer and use it in GitHub Desktop.
JS - bindForBusinessEvent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, name) { | |
function bind(fn, context) { | |
// Save original args, but remove the first 2 arguments (fn, context). | |
var outerArgs = Array.prototype.splice.call(arguments, 2); | |
return function() { | |
// Wipe out first argument, which is a "event" object. | |
var innerArgs = Array.prototype.splice.call(arguments, 1); | |
return fn.apply(context, innerArgs.concat(outerArgs)); | |
} | |
} | |
root[name] = bind; | |
}(App, 'bindForBusinessEvent')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment