mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-04 13:35:46 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			403 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			403 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();
 |