mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 10:56:31 +08:00
feature (upload): upload queue that show progress with abort and retry - #267
This commit is contained in:
16
client/helpers/upload.js
Normal file
16
client/helpers/upload.js
Normal file
@ -0,0 +1,16 @@
|
||||
const Upload = function () {
|
||||
let fn = null;
|
||||
|
||||
return {
|
||||
add: function (path, files) {
|
||||
if (!fn) { return window.setTimeout(() => this.add(path, files), 50); }
|
||||
fn(path, files);
|
||||
return Promise.resolve();
|
||||
},
|
||||
subscribe: function (_fn) {
|
||||
fn = _fn;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const upload = new Upload();
|
||||
Reference in New Issue
Block a user