Skip to content

Commit 021581f

Browse files
committed
0.0.4
1 parent 8e23130 commit 021581f

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

dist/uploader.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Uploader - Uploader library implements html5 file upload and provides multiple simultaneous, stable, fault tolerant and resumable uploads
3-
* @version v0.0.3
3+
* @version v0.0.4
44
* @author dolymood <[email protected]>
55
* @link https://github.com/simple-uploader/Uploader
66
* @license MIT
@@ -352,7 +352,7 @@ var event = _dereq_('./event')
352352
var File = _dereq_('./file')
353353
var Chunk = _dereq_('./chunk')
354354

355-
var version = '0.0.3'
355+
var version = '0.0.4'
356356

357357
// ie10+
358358
var ie10plus = window.navigator.msPointerEnabled
@@ -503,6 +503,12 @@ utils.extend(Uploader.prototype, {
503503
this.addFiles([file], evt)
504504
},
505505

506+
cancel: function () {
507+
for (var i = this.fileList.length - 1; i >= 0; i--) {
508+
this.fileList[i].cancel()
509+
}
510+
},
511+
506512
removeFile: function (file) {
507513
File.prototype.removeFile.call(this, file)
508514
this._trigger('fileRemoved', file)
@@ -814,6 +820,7 @@ function File (uploader, file, parent) {
814820
this.fileList = []
815821
this.chunks = []
816822
this._errorFiles = []
823+
this.id = utils.uid()
817824

818825
if (this.isRoot || !file) {
819826
this.file = null
@@ -990,7 +997,7 @@ utils.extend(File.prototype, {
990997
this.averageSpeed = 0
991998
uploader._trigger('fileSuccess', rootFile, this, message, chunk)
992999
if (rootFile.isComplete()) {
993-
uploader._trigger('fileComplete', rootFile)
1000+
uploader._trigger('fileComplete', rootFile, this)
9941001
}
9951002
} else if (!this._progeressId) {
9961003
triggerProgress()
@@ -1092,12 +1099,6 @@ utils.extend(File.prototype, {
10921099
},
10931100

10941101
cancel: function () {
1095-
if (this.isFolder) {
1096-
for (var i = this.files.length - 1; i >= 0; i--) {
1097-
this.files[i].cancel()
1098-
}
1099-
return
1100-
}
11011102
this.uploader.removeFile(this)
11021103
},
11031104

@@ -1337,8 +1338,11 @@ var isPlainObject = function (obj) {
13371338
return serialize.call(obj) === '[object Object]' && Object.getPrototypeOf(obj) === oproto
13381339
}
13391340

1341+
var i = 0
13401342
var utils = {
1341-
1343+
uid: function () {
1344+
return ++i
1345+
},
13421346
noop: function () {},
13431347
bind: function (fn, context) {
13441348
return function () {

0 commit comments

Comments
 (0)