Created
April 6, 2015 08:17
-
-
Save notthetup/7eaf66f16e3721971d5a to your computer and use it in GitHub Desktop.
Load Manager
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 toLoad = 0; | |
function loadManager(callback){ | |
toLoad++; | |
var onload = function(){ | |
toLoad--; | |
if (typeof callback === 'function'){ | |
callback(); | |
} | |
if (toLoad === 0){ | |
if (typeof onLoadAll === 'function'){ | |
onLoadAll(); | |
} | |
} | |
} | |
return onload; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment