Commit d0fe99b8 authored by martin hou's avatar martin hou

fix: 修改onprogress的调用时机

parent 3e720d88
......@@ -294,6 +294,10 @@ function Jensen(log, conn) {
self.timewait = cmd.command == TRANSFER_FILE || cmd.command == GET_FILE_BLOCK ? 1000 : 10;
console.log(pid + '-send', data);
if (self.onprogress && cmd.command == TRANSFER_FILE)
{
try { self.onprogress(0); } catch(e) {}
}
await device.transferOut(1, data).catch((e) => crash('sendNext', e));
if (cmd.onprogress) cmd.onprogress(1, 1);
/*
......@@ -1051,7 +1055,8 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
};
// this.onreceive = onprogress;
this._progress_report = {};
try { onprogress(0); } catch(e) {}
// try { onprogress(0); } catch(e) {}
this.onprogress = onprogress;
this.onreceive = function(recvBytes)
{
let percent = Math.floor(recvBytes / length * 100);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment