Skip to content

Commit

Permalink
0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dolymood committed Aug 21, 2017
1 parent 8e23130 commit 021581f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
24 changes: 14 additions & 10 deletions dist/uploader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Uploader - Uploader library implements html5 file upload and provides multiple simultaneous, stable, fault tolerant and resumable uploads
* @version v0.0.3
* @version v0.0.4
* @author dolymood <[email protected]>
* @link https://github.com/simple-uploader/Uploader
* @license MIT
Expand Down Expand Up @@ -352,7 +352,7 @@ var event = _dereq_('./event')
var File = _dereq_('./file')
var Chunk = _dereq_('./chunk')

var version = '0.0.3'
var version = '0.0.4'

// ie10+
var ie10plus = window.navigator.msPointerEnabled
Expand Down Expand Up @@ -503,6 +503,12 @@ utils.extend(Uploader.prototype, {
this.addFiles([file], evt)
},

cancel: function () {
for (var i = this.fileList.length - 1; i >= 0; i--) {
this.fileList[i].cancel()
}
},

removeFile: function (file) {
File.prototype.removeFile.call(this, file)
this._trigger('fileRemoved', file)
Expand Down Expand Up @@ -814,6 +820,7 @@ function File (uploader, file, parent) {
this.fileList = []
this.chunks = []
this._errorFiles = []
this.id = utils.uid()

if (this.isRoot || !file) {
this.file = null
Expand Down Expand Up @@ -990,7 +997,7 @@ utils.extend(File.prototype, {
this.averageSpeed = 0
uploader._trigger('fileSuccess', rootFile, this, message, chunk)
if (rootFile.isComplete()) {
uploader._trigger('fileComplete', rootFile)
uploader._trigger('fileComplete', rootFile, this)
}
} else if (!this._progeressId) {
triggerProgress()
Expand Down Expand Up @@ -1092,12 +1099,6 @@ utils.extend(File.prototype, {
},

cancel: function () {
if (this.isFolder) {
for (var i = this.files.length - 1; i >= 0; i--) {
this.files[i].cancel()
}
return
}
this.uploader.removeFile(this)
},

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

var i = 0
var utils = {

uid: function () {
return ++i
},
noop: function () {},
bind: function (fn, context) {
return function () {
Expand Down
Loading

0 comments on commit 021581f

Please sign in to comment.