Created
September 28, 2010 22:54
-
-
Save amiel/601965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 this_will_only_run_once = (function() { | |
var has_been_run = false; // this private variable will be kept between runs, but doesn't pollute the global namespace | |
return function() { | |
if (has_been_run) return; has_been_run = true; | |
// do stuff here, it will only be run once | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment