diff options
-rw-r--r-- | itjs/loader.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/itjs/loader.js b/itjs/loader.js index 0208d5a..91f280d 100644 --- a/itjs/loader.js +++ b/itjs/loader.js @@ -51,7 +51,7 @@ load: function(baseurl, pos, num, query_volatile, retry) this.num = num; this.query_volatile = query_volatile; - if (this.loader && this.loader.stop) + if (this.loader) this.stop(); while ((num > 0) && this.entry[pos]) @@ -230,11 +230,7 @@ dataReady: function(data, callid) this.load(this.baseurl, this.end, this.pos + this.num - this.end); } - if (this.scrpt) - { - document.body.removeChild(this.scrpt); - this.scrpt = null; - } + this.unlink(); }, stop: function() @@ -245,7 +241,22 @@ stop: function() } catch (e) { } - this.loader = null; + this.unlink(); +}, + +unlink: function() +{ + if (it_loader['__inst'+this.instance]) + it_loader['__inst'+this.instance] = null; + + if (this.loader) + this.loader = null; + + if (this.scrpt) + { + document.body.removeChild(this.scrpt); + this.scrpt = null; + } }/* NO COMMA */ } |