-
-
Save rekkusu/1151837 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?document.body:document.getElementsByTagName("head")[0]).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