mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-10-31 18:16:00 +08:00 
			
		
		
		
	feature (notification): proper notification system
This commit is contained in:
		
							
								
								
									
										17
									
								
								client/helpers/notify.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								client/helpers/notify.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| const Message = function (){ | ||||
|     let fn = null; | ||||
|  | ||||
|     return { | ||||
|         send: function(text, type){ | ||||
|             if(['info', 'success', 'error'].indexOf(type) === -1){ type = 'info'; } | ||||
|             if(!fn){ return window.setTimeout(() => this.send(text,type), 50); } | ||||
|             fn(text, type); | ||||
|             return Promise.resolve(); | ||||
|         }, | ||||
|         subscribe: function(_fn){ | ||||
|             fn = _fn; | ||||
|         } | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| export const notify = new Message(); | ||||
		Reference in New Issue
	
	Block a user
	 Mickael KERJEAN
					Mickael KERJEAN