mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-04 05:27:04 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			377 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			377 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
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();
 |