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

Commit cd66bf9

Browse files
committed
1.1.2
1 parent f2860d5 commit cd66bf9

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

dist/uploader.js

Lines changed: 18 additions & 5 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.1.1 - 2015-08-05T02:10:41.396Z
4+
* Version: 1.1.2 - 2015-10-27T03:09:52.784Z
55
* License: MIT
66
*/
77

@@ -74,6 +74,10 @@ function uiUploader($log) {
7474
return (bytes / Math.pow(1024, i)).toFixed(i ? 1 : 0) + ' ' + sizes[isNaN(bytes) ? 0 : i + 1];
7575
}
7676

77+
function isFunction(entity) {
78+
return typeof(entity) === typeof(Function);
79+
}
80+
7781
function ajaxUpload(file, url, data) {
7882
var xhr, formData, prop, key = '' || 'file';
7983
data = data || {};
@@ -105,23 +109,32 @@ function uiUploader($log) {
105109
//console.info(event.loaded);
106110
file.loaded = event.loaded;
107111
file.humanSize = getHumanSize(event.loaded);
108-
self.options.onProgress(file);
112+
if (isFunction(self.options.onProgress)) {
113+
self.options.onProgress(file);
114+
}
109115
};
110116

111117
// Triggered when upload is completed:
112118
xhr.onload = function() {
113119
self.activeUploads -= 1;
114120
self.uploadedFiles += 1;
115121
startUpload(self.options);
116-
self.options.onCompleted(file, xhr.responseText, xhr.status);
122+
if (isFunction(self.options.onCompleted)) {
123+
self.options.onCompleted(file, xhr.responseText, xhr.status);
124+
}
117125
if (self.uploadedFiles === self.files.length) {
118126
self.uploadedFiles = 0;
119-
self.options.onCompletedAll(self.files);
127+
if (isFunction(self.options.onCompletedAll)) {
128+
self.options.onCompletedAll(self.files);
129+
}
120130
}
121131
};
122132

123133
// Triggered when upload fails:
124-
xhr.onerror = function() {
134+
xhr.onerror = function(e) {
135+
if (isFunction(self.options.onError)) {
136+
self.options.onError(e);
137+
}
125138
};
126139

127140
// Append additional data if provided:

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.1.1",
3+
"version": "1.1.2",
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)