mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Update webloader.js
This commit is contained in:
parent
697bb71f49
commit
47273e75b8
10
webloader.js
10
webloader.js
|
@ -120,18 +120,18 @@ return {
|
|||
},
|
||||
addScript: function(url, callback, test, ttl) {
|
||||
var _callback = function(el, ttl) {
|
||||
setTimeout(function() {
|
||||
var result = test(el);
|
||||
if (typeof(result) !== "undefined") {
|
||||
callback(el);
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
if (ttl > 0) {
|
||||
_callback(el, ttl - 50);
|
||||
_callback(el, ttl - 1);
|
||||
} else {
|
||||
console.log("failed load " + url);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
|
||||
var el = document.createElement("script");
|
||||
|
@ -143,7 +143,7 @@ return {
|
|||
if (typeof(test) === "function") {
|
||||
// "Time-To-Live: default value is 30 seconds";
|
||||
ttl = (typeof(ttl) == "number" ? ttl : 30000);
|
||||
_callback(el, ttl);
|
||||
el.onload = _callback(el, ttl);
|
||||
} else if (typeof(callback) === "function") {
|
||||
el.onload = callback(el);
|
||||
}
|
||||
|
@ -224,7 +224,9 @@ return {
|
|||
// };
|
||||
|
||||
// "set movable window";
|
||||
if (self.getIEVersion() > 8) {
|
||||
self.setMovableWindow();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user