From f3579ae0f947b3bedf0c1073119e982a3ff963e3 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 30 Aug 2021 17:18:13 +0200 Subject: [PATCH] [New] Always call callback on dialog close, passing confirmed value --- bower.json | 2 +- strolch-wc-information-dialog.html | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 0132adf..d1ef775 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "strolch-wc-information-dialog", "description": "Strolch WebComponent Information Dialog", - "version": "0.1.2", + "version": "0.1.3", "authors": [ "Robert von Burg" ], diff --git a/strolch-wc-information-dialog.html b/strolch-wc-information-dialog.html index 9a5e842..50ba8e7 100644 --- a/strolch-wc-information-dialog.html +++ b/strolch-wc-information-dialog.html @@ -34,12 +34,12 @@
@@ -99,7 +99,23 @@ observers: [], + _onClose: function () { + if (this.confirmation) { + this._confirm(false); + } else { + this.close(); + } + }, + _onOk: function () { + if (this.confirmation) { + this._confirm(true); + } else { + this.close(); + } + }, + + _confirm: function (confirmed) { if (this.callback == null) { console.log("Bad dlg config: no callback!"); alert("Bad dlg config: no callback!"); @@ -108,7 +124,7 @@ alert("Bad dlg config: callback is not a function, but is " + (typeof this.callback)); } else { try { - this.callback(true); + this.callback(confirmed); this.close(); } catch (e) { console.log(e);