Created
August 17, 2011 09:53
-
-
Save KOBA789/1151230 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 load = new (function () { | |
var count = 0; | |
var next = function () {} | |
var callback = function () { | |
count --; | |
if (count <= 0) { | |
next(); | |
} | |
} | |
self = this; | |
this.load = function (src) { | |
count ++; | |
var scriptElement = document.createElement('script'); | |
scriptElement.type = 'text/javascript'; | |
scriptElement.onload = callback; | |
scriptElement.src = src; | |
document.body.appendChild(scriptElement); | |
return self; | |
} | |
this.then = function (callback) { | |
next = callback; | |
} | |
})().load; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment