Commit 1321c9ce authored by martin hou's avatar martin hou

fix: 调整进度汇报接口

parent 67ba2803
...@@ -1019,12 +1019,12 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress) ...@@ -1019,12 +1019,12 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
this.onprogress = onprogress; this.onprogress = onprogress;
this.onreceive = function(recvBytes) this.onreceive = function(recvBytes)
{ {
let percent = Math.floor(recvBytes / length * 100); let percent = Math.ceil(recvBytes / length * 100);
let k = 't' + percent; let k = 't' + percent;
if (percent % 5 == 0 && percent > 0 && percent < 100 && (!k in this._progress_report)) if (percent % 5 == 0 && percent > 0 && percent < 100)
{ {
Logger.info('jensen', 'file-transfer', percent); Logger.info('jensen', 'file-transfer', percent);
onprogress?.(recvBytes); !this._progress_report[k] && onprogress?.(recvBytes);
this._progress_report[k] = true; this._progress_report[k] = true;
} }
if (percent == 100) if (percent == 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