feature (notification): proper notification system

This commit is contained in:
Mickael KERJEAN
2018-04-06 13:09:22 +10:00
parent 22d2cd7b00
commit 4b06b8a802
14 changed files with 185 additions and 145 deletions

17
client/helpers/notify.js Normal file
View 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();