Skip to content
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
20 changes: 18 additions & 2 deletions evaporate.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,23 @@
this.loaded += loadedNow;
this.fileTotalBytesUploaded += loadedNow;
};
/**
* @deprecated since version 2.1.5
* Will be deleted in version 2.2.
*
* Please change your implementation to use the
* correctly spelled function `progressStats`
*/
FileUpload.prototype.progessStats = function () {
if(console && console.warn) {
console.warn(
'progessStats is deprecated. Please change to the function '
+ 'progressStats as this function will be removed in a future version');
}
return this.progressStats();
}

FileUpload.prototype.progressStats = function () {
// Adapted from https://github.com/fkjaekel
// https://github.com/TTLabs/EvaporateJS/issues/13
if (this.fileTotalBytesUploaded === 0) {
Expand Down Expand Up @@ -521,7 +537,7 @@
};
FileUpload.prototype.onProgress = function () {
if ([ABORTED, PAUSED].indexOf(this.status) === -1) {
this.progress(this.fileTotalBytesUploaded / this.sizeBytes, this.progessStats());
this.progress(this.fileTotalBytesUploaded / this.sizeBytes, this.progressStats());
this.loaded = 0;
}
};
Expand Down Expand Up @@ -773,7 +789,7 @@
historyCache.setItem('awsUploads', JSON.stringify(uploads));
}

this.complete(xhr, this.name, this.progessStats());
this.complete(xhr, this.name, this.progressStats());
this.setStatus(COMPLETE);
this.onProgress();
};
Expand Down
6 changes: 3 additions & 3 deletions test/evaporate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,15 @@ test('should call a callback on successful add()', (t) => {
})

test('should call a callback on successful initiate()', (t) => {
const initated_spy = sinon.spy()
const initiated_spy = sinon.spy()

const config = Object.assign({}, baseAddConfig, {
uploadInitiated: initated_spy
uploadInitiated: initiated_spy
})

return testCommon(t, config)
.then(function () {
expect(initated_spy.withArgs('Hzr2sK034dOrV4gMsYK.MMrtWIS8JVBPKgeQ.LWd6H8V2PsLecsBqoA1cG1hjD3G4KRX_EBEwxWWDu8lNKezeA--').calledOnce).to.be.true
expect(initiated_spy.withArgs('Hzr2sK034dOrV4gMsYK.MMrtWIS8JVBPKgeQ.LWd6H8V2PsLecsBqoA1cG1hjD3G4KRX_EBEwxWWDu8lNKezeA--').calledOnce).to.be.true
})
})

Expand Down