From f4633d14297a5ee4986ab22c0a8ca73f73eb82c4 Mon Sep 17 00:00:00 2001 From: qbi Date: Sat, 8 May 2021 23:54:36 +0200 Subject: [PATCH] JS-Datei mit Popup --- malen.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/malen.js b/malen.js index 8bd87b3..0f6e851 100644 --- a/malen.js +++ b/malen.js @@ -1,4 +1,18 @@ -WA.onEnterZone('malen-1', () => { - WA.sendChatMessage("Hello!", 'Mr Robot'); -}) +let helloWorldPopup; +// Open the popup when we enter a given zone +helloWorldPopup = WA.onEnterZone('malen-1', () => { + WA.openPopup("popupRectangle", 'Hello world!', [{ + label: "Close", + className: "primary", + callback: (popup) => { + // Close the popup when the "Close" button is pressed. + popup.close(); + } + }); +}]); + +// Close the popup when we leave the zone. +WA.onLeaveZone('malen-1', () => { + helloWorldPopup.close(); +});