Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 42f4dd9

Browse files
committed
1.3.0
1 parent d2a9407 commit 42f4dd9

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

dist/uploader.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-ui-uploader
33
* https://github.com/angular-ui/ui-uploader
4-
* Version: 1.2.1 - 2016-10-17T11:29:10.175Z
4+
* Version: 1.3.0 - 2016-11-10T00:39:35.417Z
55
* License: MIT
66
*/
77

@@ -122,14 +122,34 @@ function uiUploader($log) {
122122
}
123123
};
124124

125-
// Triggered when upload is completed:
125+
// Triggered when the upload is successful (the server may not have responded yet).
126126
xhr.upload.onload = function() {
127+
128+
if (angular.isFunction(self.options.onUploadSuccess)) {
129+
self.options.onUploadSuccess(file);
130+
}
131+
};
132+
133+
// Triggered when upload fails:
134+
xhr.upload.onerror = function(e) {
135+
if (angular.isFunction(self.options.onError)) {
136+
self.options.onError(e);
137+
}
138+
};
139+
140+
// Triggered when the upload has completed AND the server has responded. Equivalent to
141+
// listening for the readystatechange event when xhr.readyState === XMLHttpRequest.DONE.
142+
xhr.onload = function () {
143+
127144
self.activeUploads -= 1;
128145
self.uploadedFiles += 1;
146+
129147
startUpload(self.options);
148+
130149
if (angular.isFunction(self.options.onCompleted)) {
131150
self.options.onCompleted(file, xhr.responseText, xhr.status);
132-
}
151+
}
152+
133153
if (self.activeUploads === 0) {
134154
self.uploadedFiles = 0;
135155
if (angular.isFunction(self.options.onCompletedAll)) {
@@ -138,13 +158,6 @@ function uiUploader($log) {
138158
}
139159
};
140160

141-
// Triggered when upload fails:
142-
xhr.upload.onerror = function(e) {
143-
if (angular.isFunction(self.options.onError)) {
144-
self.options.onError(e);
145-
}
146-
};
147-
148161
// Append additional data if provided:
149162
if (data) {
150163
for (prop in data) {

dist/uploader.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-uploader",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"author": "https://github.com/angular-ui/ui-uploader/graphs/contributors",
55
"license": "MIT",
66
"homepage": "https://github.com/angular-ui/ui-uploader",

0 commit comments

Comments
 (0)