gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: do presence ann


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: do presence announcement only after complete page load
Date: Fri, 02 Jun 2017 02:14:44 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new a6035dd4 do presence announcement only after complete page load
a6035dd4 is described below

commit a6035dd4c74bd83a1eb0deb37fb7b22a2e97fd39
Author: Florian Dold <address@hidden>
AuthorDate: Fri Jun 2 02:14:40 2017 +0200

    do presence announcement only after complete page load
---
 src/webex/notify.ts | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/webex/notify.ts b/src/webex/notify.ts
index 09c5ae00..51abdb0e 100644
--- a/src/webex/notify.ts
+++ b/src/webex/notify.ts
@@ -180,26 +180,35 @@ function handlePaymentResponse(maybeFoundResponse: 
QueryPaymentResult) {
 }
 
 
+function onceOnComplete(cb: () => void) {
+  if (document.readyState === "complete") {
+    cb();
+  } else {
+    document.addEventListener("readystatechange", () => {
+      if (document.readyState === "complete") {
+        cb();
+      }
+    });
+  }
+}
+
+
 function init() {
   // Only place where we don't use the nicer RPC wrapper, since the wallet
   // backend might not be ready (during install, upgrade, etc.)
   chrome.runtime.sendMessage({type: "get-tab-cookie"}, (resp) => {
+    logVerbose && console.log("got response for get-tab-cookie");
     if (chrome.runtime.lastError) {
       logVerbose && console.log("extension not yet ready");
       window.setTimeout(init, 200);
       return;
     }
-    if (document.documentElement.getAttribute("data-taler-nojs")) {
-      const onload = () => {
+    onceOnComplete(() => {
+      if (document.documentElement.getAttribute("data-taler-nojs")) {
         initStyle();
         setStyles(true);
-      };
-      if (document.readyState === "complete") {
-        onload();
-      } else {
-        document.addEventListener("DOMContentLoaded", onload);
       }
-    }
+    });
     registerHandlers();
     // Hack to know when the extension is unloaded
     const port = chrome.runtime.connect();

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]