Skip to content

Commit

Permalink
优化进度反馈
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Nov 13, 2018
1 parent d45d313 commit 3067bd3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions sdk/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ var throttleOnProgress = function (total, onProgress) {
var time0 = Date.now();
var time1;
var timer;
var preInfo = {};
function update() {
timer = 0;
if (onProgress && (typeof onProgress === 'function')) {
Expand All @@ -424,14 +423,7 @@ var throttleOnProgress = function (total, onProgress) {
time0 = time1;
size0 = size1;
try {
var curInfo = {loaded: size1, total: total, speed: speed, percent: percent};
if (curInfo.loaded !== preInfo.loaded ||
curInfo.total !== preInfo.total ||
curInfo.speed !== preInfo.speed ||
curInfo.percent !== preInfo.percent) {
onProgress(curInfo);
}
preInfo = curInfo;
onProgress({loaded: size1, total: total, speed: speed, percent: percent});
} catch (e) {
}
}
Expand Down

0 comments on commit 3067bd3

Please sign in to comment.