diff options
-rw-r--r-- | www/js/importer.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index 4c6ddb9..6579d4e 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -352,6 +352,8 @@ Rdxport.Upload = function(fileOrsourceUri, group, groupView, cartNumber, useMeta this.error = false; this.errorStatus = ''; this.errorString = ''; + + this.uploadInterval = null; }; Rdxport.Upload.prototype.isUploading = function() { @@ -384,7 +386,7 @@ Rdxport.Upload.prototype.onmessage = function(event) { this.groupView.uploadProgress(this); break; case Rdxport.Importer.TYPE_PROGRESS: - console.log(data); + //console.log(data); this.uploadprogress.current = data.CURRENT; this.uploadprogress.total = data.TOTAL; this.uploadprogress.progress = data.PROGRESS; @@ -418,7 +420,7 @@ Rdxport.Upload.prototype.onmessage = function(event) { var start = 0; var end = chunkSize; var self = this; - var interval = setInterval(function() { + this.uploadInterval = setInterval(function() { for(var i = 0; i < 16; i++) { if (self.webSocket.bufferedAmount > 16 * chunkSize) { return true; @@ -427,7 +429,7 @@ Rdxport.Upload.prototype.onmessage = function(event) { self.webSocket.send(blob); if (self.file.size === end) { - clearInterval(interval); + clearInterval(self.uploadInterval); return true; } start += chunkSize; @@ -501,6 +503,7 @@ Rdxport.Upload.prototype.close = function() { }; Rdxport.Upload.prototype.cancel = function() { + clearInterval(this.uploadInterval); this.webSocket.send(JSON.stringify({ COMMAND: 'cancel' })); }; |