summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2016-07-17 17:19:23 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2016-07-17 17:19:23 (GMT)
commiteee0121b10ac9e4d1aad7a8347d158d3c02fa4ba (patch)
tree11b09c502c21226628fa9d5d094e0fa9eec502e7 /www
parente69b9acd4978bccd79979678861da7b9172ad72d (diff)
fix cancel uploads
Diffstat (limited to 'www')
-rw-r--r--www/js/importer.js9
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' }));
};