MCPcopy
hub / github.com/dropzone/dropzone / cancelUpload

Method cancelUpload

src/dropzone.js:1176–1205  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

1174 // If it's still in the queue, the file is being removed from it and the status
1175 // set to CANCELED.
1176 cancelUpload(file) {
1177 if (file.status === Dropzone.UPLOADING) {
1178 let groupedFiles = this._getFilesWithXhr(file.xhr);
1179 for (let groupedFile of groupedFiles) {
1180 groupedFile.status = Dropzone.CANCELED;
1181 }
1182 if (typeof file.xhr !== "undefined") {
1183 file.xhr.abort();
1184 }
1185 for (let groupedFile of groupedFiles) {
1186 this.emit("canceled", groupedFile);
1187 }
1188 if (this.options.uploadMultiple) {
1189 this.emit("canceledmultiple", groupedFiles);
1190 }
1191 } else if (
1192 file.status === Dropzone.ADDED ||
1193 file.status === Dropzone.QUEUED
1194 ) {
1195 file.status = Dropzone.CANCELED;
1196 this.emit("canceled", file);
1197 if (this.options.uploadMultiple) {
1198 this.emit("canceledmultiple", [file]);
1199 }
1200 }
1201
1202 if (this.options.autoProcessQueue) {
1203 return this.processQueue();
1204 }
1205 }
1206
1207 resolveOption(option, ...args) {
1208 if (typeof option === "function") {

Callers 3

disableMethod · 0.95
removeFileMethod · 0.95
test.jsFile · 0.80

Calls 3

_getFilesWithXhrMethod · 0.95
processQueueMethod · 0.95
emitMethod · 0.80

Tested by

no test coverage detected