Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 2 callbacks onRemoveFromQueue and onClearQueue #556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions dist/angular-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.queue.splice(index, 1);
item._destroy();
this.progress = this._getTotalProgress();
this.onRemoveFromQueue(item, index);
}
},
clearQueue: {
Expand All @@ -245,6 +246,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.queue[0].remove();
}
this.progress = 0;
this.onClearQueue();
}
},
uploadItem: {
Expand Down Expand Up @@ -496,6 +498,22 @@ return /******/ (function(modules) { // webpackBootstrap

value: function onCompleteAll() {}
},
onRemoveFromQueue: {
/**
* Callback
* @param {FileItem} item
* @param {Number} index
*/

value: function onRemoveFromQueue(item, index) {}
},
onClearQueue: {
/**
* Callback
*/

value: function onClearQueue() {}
},
_getTotalProgress: {
/**********************
* PRIVATE
Expand Down Expand Up @@ -1995,5 +2013,4 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }
/******/ ])
});
;
//# sourceMappingURL=angular-file-upload.js.map
;
3 changes: 1 addition & 2 deletions dist/angular-file-upload.min.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion examples/image-preview/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ angular
uploader.onCompleteAll = function() {
console.info('onCompleteAll');
};

uploader.onRemoveFromQueue = function(item, index) {
console.info('onRemoveFromQueue', item, index);
};
uploader.onClearQueue = function() {
console.info('onClearQueue');
};

console.info('uploader', uploader);
}]);
6 changes: 6 additions & 0 deletions examples/simple/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ angular
uploader.onCompleteAll = function() {
console.info('onCompleteAll');
};
uploader.onRemoveFromQueue = function(item, index) {
console.info('onRemoveFromQueue', item, index);
};
uploader.onClearQueue = function() {
console.info('onClearQueue');
};

console.info('uploader', uploader);
}]);
8 changes: 7 additions & 1 deletion examples/without-bootstrap/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ angular
uploader.onCompleteAll = function() {
console.info('onCompleteAll');
};

uploader.onRemoveFromQueue = function(item, index) {
console.info('onRemoveFromQueue', item, index);
};
uploader.onClearQueue = function() {
console.info('onClearQueue');
};

console.info('uploader', uploader);


Expand Down
14 changes: 14 additions & 0 deletions src/services/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default (fileUploaderOptions, $rootScope, $http, $window, FileLikeObject,
this.queue.splice(index, 1);
item._destroy();
this.progress = this._getTotalProgress();
this.onRemoveFromQueue(item, index);
}
/**
* Clears the queue
Expand All @@ -102,6 +103,7 @@ export default (fileUploaderOptions, $rootScope, $http, $window, FileLikeObject,
this.queue[0].remove();
}
this.progress = 0;
this.onClearQueue();
}
/**
* Uploads a item from the queue
Expand Down Expand Up @@ -285,6 +287,18 @@ export default (fileUploaderOptions, $rootScope, $http, $window, FileLikeObject,
*/
onCompleteAll() {
}
/**
* Callback
* @param {FileItem} item
* @param {Number} index
*/
onRemoveFromQueue(item, index) {
}
/**
* Callback
*/
onClearQueue() {
}
/**********************
* PRIVATE
**********************/
Expand Down