From 6b7e6b6b5af613960488659556f77f4ade50c9e2 Mon Sep 17 00:00:00 2001 From: BaobabCoder Date: Mon, 31 Jul 2017 11:50:59 +0200 Subject: [PATCH 1/4] manually close alert on click --- bert.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bert.js b/bert.js index aae0069..05b6a5f 100644 --- a/bert.js +++ b/bert.js @@ -59,7 +59,9 @@ class BertAlert { bertTimer() { clearTimeout( this.timer ); - this.timer = setTimeout( () => { this.hide(); }, this.defaults.hideDelay ); + if(this.defaults.hideDelay > 0) { + this.timer = setTimeout( () => { this.hide(); }, this.defaults.hideDelay ); + } return this.timer; } From ee01f01f80a5ae40f9a61dd2fe2fba50e5916a17 Mon Sep 17 00:00:00 2001 From: BaobabCoder Date: Mon, 31 Jul 2017 12:12:02 +0200 Subject: [PATCH 2/4] add possibility to define a value for hideDelay in alert call --- bert.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bert.js b/bert.js index 05b6a5f..832807d 100644 --- a/bert.js +++ b/bert.js @@ -28,7 +28,8 @@ class BertAlert { this.defaults = { hideDelay: 3500, style: 'fixed-top', - type: 'default' + type: 'default', + autoHide: true }; } @@ -59,7 +60,7 @@ class BertAlert { bertTimer() { clearTimeout( this.timer ); - if(this.defaults.hideDelay > 0) { + if(this.hideDelay > 0) { this.timer = setTimeout( () => { this.hide(); }, this.defaults.hideDelay ); } return this.timer; @@ -88,7 +89,8 @@ class BertAlert { 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; @@ -97,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 }); } } From b656ceb655eff03662723b99fdd65f10331964c6 Mon Sep 17 00:00:00 2001 From: BaobabCoder Date: Mon, 31 Jul 2017 12:22:31 +0200 Subject: [PATCH 3/4] erratum --- bert.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bert.js b/bert.js index 832807d..0a4d14d 100644 --- a/bert.js +++ b/bert.js @@ -28,8 +28,7 @@ class BertAlert { this.defaults = { hideDelay: 3500, style: 'fixed-top', - type: 'default', - autoHide: true + type: 'default' }; } From d321a4a3bd4160477b5b1ebe786be65030266e84 Mon Sep 17 00:00:00 2001 From: BaobabCoder Date: Sat, 19 Aug 2017 11:32:37 +0200 Subject: [PATCH 4/4] Fix hide delay --- bert.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bert.js b/bert.js index 0a4d14d..e0cfbf1 100644 --- a/bert.js +++ b/bert.js @@ -59,8 +59,9 @@ class BertAlert { bertTimer() { clearTimeout( this.timer ); - if(this.hideDelay > 0) { - 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; } @@ -82,7 +83,7 @@ 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 || "",