Skip to content

Commit 489cddb

Browse files
committed
Fixed #227: progress event & abort
1 parent 5fc3897 commit 489cddb

File tree

5 files changed

+29
-23
lines changed

5 files changed

+29
-23
lines changed

dist/FileAPI.html5.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,15 +1142,17 @@
11421142
data.total = (data.total || data.size);
11431143
data.loaded = data.total;
11441144

1145-
// emulate 100% "progress"
1146-
this.progress(data);
1145+
if( !err ) {
1146+
// emulate 100% "progress"
1147+
this.progress(data);
11471148

1148-
// fixed throttle event
1149-
_fileLoaded = true;
1149+
// fixed throttle event
1150+
_fileLoaded = true;
11501151

1151-
// bytes loaded
1152-
_loaded += data.size; // data.size != data.total, it's desirable fix this
1153-
proxyXHR.loaded = _loaded;
1152+
// bytes loaded
1153+
_loaded += data.size; // data.size != data.total, it's desirable fix this
1154+
proxyXHR.loaded = _loaded;
1155+
}
11541156

11551157
// emit "filecomplete" event
11561158
options.filecomplete(err, xhr, _file, _fileOptions);

dist/FileAPI.html5.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FileAPI.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,15 +1142,17 @@
11421142
data.total = (data.total || data.size);
11431143
data.loaded = data.total;
11441144

1145-
// emulate 100% "progress"
1146-
this.progress(data);
1145+
if( !err ) {
1146+
// emulate 100% "progress"
1147+
this.progress(data);
11471148

1148-
// fixed throttle event
1149-
_fileLoaded = true;
1149+
// fixed throttle event
1150+
_fileLoaded = true;
11501151

1151-
// bytes loaded
1152-
_loaded += data.size; // data.size != data.total, it's desirable fix this
1153-
proxyXHR.loaded = _loaded;
1152+
// bytes loaded
1153+
_loaded += data.size; // data.size != data.total, it's desirable fix this
1154+
proxyXHR.loaded = _loaded;
1155+
}
11541156

11551157
// emit "filecomplete" event
11561158
options.filecomplete(err, xhr, _file, _fileOptions);

dist/FileAPI.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/FileAPI.core.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,15 +1048,17 @@
10481048
data.total = (data.total || data.size);
10491049
data.loaded = data.total;
10501050

1051-
// emulate 100% "progress"
1052-
this.progress(data);
1051+
if( !err ) {
1052+
// emulate 100% "progress"
1053+
this.progress(data);
10531054

1054-
// fixed throttle event
1055-
_fileLoaded = true;
1055+
// fixed throttle event
1056+
_fileLoaded = true;
10561057

1057-
// bytes loaded
1058-
_loaded += data.size; // data.size != data.total, it's desirable fix this
1059-
proxyXHR.loaded = _loaded;
1058+
// bytes loaded
1059+
_loaded += data.size; // data.size != data.total, it's desirable fix this
1060+
proxyXHR.loaded = _loaded;
1061+
}
10601062

10611063
// emit "filecomplete" event
10621064
options.filecomplete(err, xhr, _file, _fileOptions);

0 commit comments

Comments
 (0)