Add progress bar for pad download

This commit is contained in:
ClemDee 2019-08-14 15:42:32 +02:00
parent 2ee3b77a43
commit f017215300
3 changed files with 16 additions and 5 deletions

View File

@ -92,7 +92,15 @@ define([
var opts = {
password: pData.password
};
updateProgress.progress(0);
var done = false;
ctx.sframeChan.on("EV_CRYPTGET_PROGRESS", function (data) {
if (done || data.hash !== parsed.hash) { return; }
updateProgress.progress(data.progress);
if (data.progress === 1) {
done = true;
updateProgress.progress2(1);
}
});
ctx.get({
hash: parsed.hash,
opts: opts
@ -100,12 +108,9 @@ define([
if (cancelled) { return; }
if (err) { return; }
if (!val) { return; }
updateProgress.progress(1);
transform(ctx, parsed.type, val, function (res) {
if (cancelled) { return; }
if (!res.data) { return; }
updateProgress.progress2(1);
var dl = function () {
saveAs(res.data, Util.fixFileName(name));
};

View File

@ -482,6 +482,7 @@ define([
var ctx = {
get: common.getPad,
sframeChan: sframeChan,
};
var dl = downloadFunction(ctx, data, function (err, obj) {
$link.prepend($('<span>', {'class': 'fa fa-external-link'}))

View File

@ -880,7 +880,12 @@ define([
error: err,
data: val
});
}, data.opts);
}, data.opts, function (progress) {
sframeChan.event("EV_CRYPTGET_PROGRESS", {
hash: data.hash,
progress: progress,
});
});
};
//return void todo();
if (i > 30) {