Last active
August 29, 2015 14:14
-
-
Save ElliotChong/eb6003acde2ceb11f786 to your computer and use it in GitHub Desktop.
When you're the only script that should work on a page.
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
var HighlanderJS = (function (immortals) { | |
var highlander = {}; | |
for (var immortal in immortals) { | |
highlander[immortal] = immortals[immortal]; | |
delete immortals[immortal]; | |
} | |
immortals.HighlanderJS = function (onlyOne) { | |
onlyOne.apply(highlander); | |
}; | |
return immortals.HighlanderJS; | |
})(window); | |
HighlanderJS(function () { alert("lolz"); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment