Last active
October 12, 2015 18:29
-
-
Save sarfraznawaz2005/0a0964acf13f55118608 to your computer and use it in GitHub Desktop.
Avoid double run
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
// simple way to avoid running code again when user click a button or trigger event in some other way | |
var shutdown = function() { | |
shutdown = function() { | |
alert("don't worry - we're already processing your shutdown request"); | |
} | |
alert('This runs first!'); | |
} | |
shutdown(); | |
shutdown(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment