diff --git a/bert.js b/bert.js index aae0069..e0cfbf1 100644 --- a/bert.js +++ b/bert.js @@ -59,7 +59,10 @@ class BertAlert { bertTimer() { clearTimeout( this.timer ); - this.timer = setTimeout( () => { this.hide(); }, this.defaults.hideDelay ); + let currentAlert = Session.get('bertAlert'); + if(currentAlert.hideDelay > 0) { + this.timer = setTimeout( () => { this.hide(); }, currentAlert.hideDelay ); + } return this.timer; } @@ -80,13 +83,14 @@ class BertAlert { setBertOnSession( alert ) { if ( typeof alert[0] === 'object' ) { let type = alert[0].type || this.defaults.type; - + console.log(alert[0].hideDelay); Session.set( 'bertAlert', { title: alert[0].title || "", message: alert[0].message || "", type: type, style: alert[0].style || this.defaults.style, - icon: alert[0].icon || this.icons[ type ] + icon: alert[0].icon || this.icons[ type ], + hideDelay: alert[0].hideDelay || this.defaults.hideDelay }); } else { let type = alert[1] || this.defaults.type; @@ -95,7 +99,8 @@ class BertAlert { message: alert[0] || "", type: type, style: alert[2] || this.defaults.style, - icon: alert[3] || this.icons[ type ] + icon: alert[3] || this.icons[ type ], + hideDelay: alert[4] || this.defaults.hideDelay }); } }