gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-web-common] branch master updated: Revert "make tale


From: gnunet
Subject: [GNUnet-SVN] [taler-web-common] branch master updated: Revert "make taler-wallet-lib a proper module and output it in UMD format"
Date: Wed, 26 Apr 2017 02:11:42 +0200

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

dold pushed a commit to branch master
in repository web-common.

The following commit(s) were added to refs/heads/master by this push:
     new a8bff2e  Revert "make taler-wallet-lib a proper module and output it 
in UMD format"
a8bff2e is described below

commit a8bff2e27b89feb3696cf0e3a49fc00155d92de5
Author: Florian Dold <address@hidden>
AuthorDate: Wed Apr 26 02:11:26 2017 +0200

    Revert "make taler-wallet-lib a proper module and output it in UMD format"
    
    This reverts commit 72b28c3201f2a2cdd3e88b3916f722e050895998.
---
 taler-wallet-lib.js | 697 ++++++++++++++++++++++++++--------------------------
 taler-wallet-lib.ts |   3 +-
 tsconfig.json       |   1 -
 3 files changed, 344 insertions(+), 357 deletions(-)

diff --git a/taler-wallet-lib.js b/taler-wallet-lib.js
index 2fe1c20..fd2845f 100644
--- a/taler-wallet-lib.js
+++ b/taler-wallet-lib.js
@@ -27,420 +27,409 @@
   @author Marcello Stanisci
   @author Florian Dold
 */
-(function (factory) {
-    if (typeof module === "object" && typeof module.exports === "object") {
-        var v = factory(require, exports);
-        if (v !== undefined) module.exports = v;
+var taler;
+(function (taler) {
+    "use strict";
+    var logVerbose = false;
+    try {
+        logVerbose = !!localStorage.getItem("taler-log-verbose");
     }
-    else if (typeof define === "function" && define.amd) {
-        define(["require", "exports"], factory);
+    catch (e) {
     }
-})(function (require, exports) {
-    "use strict";
-    var taler;
-    (function (taler) {
-        "use strict";
-        var logVerbose = false;
-        try {
-            logVerbose = !!localStorage.getItem("taler-log-verbose");
-        }
-        catch (e) {
+    var presentHandlers = [];
+    var absentHandlers = [];
+    // Are we running as the content script of an 
+    // extension (and not just from a normal page)?
+    var runningInExtension = false;
+    var callSeqId = 1;
+    var installed = false;
+    var probeExecuted = false;
+    var pageLoaded = false;
+    var errorHandler = undefined;
+    var sheet;
+    function onError(handler) {
+        if (errorHandler) {
+            console.warn("Overriding error handler");
         }
-        var presentHandlers = [];
-        var absentHandlers = [];
-        // Are we running as the content script of an 
-        // extension (and not just from a normal page)?
-        var runningInExtension = false;
-        var callSeqId = 1;
-        var installed = false;
-        var probeExecuted = false;
-        var pageLoaded = false;
-        var errorHandler = undefined;
-        var sheet;
-        function onError(handler) {
-            if (errorHandler) {
-                console.warn("Overriding error handler");
-            }
-            errorHandler = handler;
+        errorHandler = handler;
+    }
+    taler.onError = onError;
+    /**
+     * Error handler for things that go wrong in the merchant
+     * frontend browser code.
+     */
+    function raise_error(reason, detail) {
+        if (errorHandler) {
+            errorHandler(reason, detail);
+            return;
         }
-        taler.onError = onError;
-        /**
-         * Error handler for things that go wrong in the merchant
-         * frontend browser code.
-         */
-        function raise_error(reason, detail) {
-            if (errorHandler) {
-                errorHandler(reason, detail);
+        alert("Failure: " + reason + ".  No error handler installed.  Open the 
developer console for more information.");
+        console.error(reason, detail);
+        console.warn("No custom error handler set.");
+    }
+    function callWallet(funcName, args, onResult) {
+        var detail = JSON.parse(JSON.stringify(args || {}));
+        var callId = callSeqId++;
+        detail.callId = callId;
+        var onTimeout = function () {
+            console.warn("timeout for invocation of " + funcName);
+        };
+        var timeoutHandle = setTimeout(onTimeout, 1000);
+        var handler = function (evt) {
+            if (evt.detail.callId !== callId) {
                 return;
             }
-            alert("Failure: " + reason + ".  No error handler installed.  Open 
the developer console for more information.");
-            console.error(reason, detail);
-            console.warn("No custom error handler set.");
+            if (onResult) {
+                onResult(evt.detail);
+            }
+            clearTimeout(timeoutHandle);
+            document.removeEventListener(funcName + "-result", handler);
+        };
+        document.addEventListener(funcName + "-result", handler);
+        var evt = new CustomEvent(funcName, { detail: detail });
+        document.dispatchEvent(evt);
+    }
+    /**
+     * Confirm that a reserve was created.
+     *
+     * Used by tightly integrated bank portals.
+     */
+    function confirmReserve(reservePub) {
+        if (!installed) {
+            logVerbose && console.log("delaying confirmReserve");
+            taler.onPresent(function () {
+                confirmReserve(reservePub);
+            });
+            return;
         }
-        function callWallet(funcName, args, onResult) {
-            var detail = JSON.parse(JSON.stringify(args || {}));
-            var callId = callSeqId++;
-            detail.callId = callId;
-            var onTimeout = function () {
-                console.warn("timeout for invocation of " + funcName);
-            };
-            var timeoutHandle = setTimeout(onTimeout, 1000);
-            var handler = function (evt) {
-                if (evt.detail.callId !== callId) {
-                    return;
-                }
-                if (onResult) {
-                    onResult(evt.detail);
-                }
-                clearTimeout(timeoutHandle);
-                document.removeEventListener(funcName + "-result", handler);
-            };
-            document.addEventListener(funcName + "-result", handler);
-            var evt = new CustomEvent(funcName, { detail: detail });
-            document.dispatchEvent(evt);
+        callWallet("taler-confirm-reserve", { reserve_pub: reservePub });
+    }
+    taler.confirmReserve = confirmReserve;
+    function createReserve(callbackUrl, amount, wtTypes, suggestedExchangeUrl) 
{
+        if (!installed) {
+            logVerbose && console.log("delaying createReserve");
+            taler.onPresent(function () {
+                createReserve(callbackUrl, amount, wtTypes, 
suggestedExchangeUrl);
+            });
+            return;
         }
+        var args = {
+            callback_url: callbackUrl,
+            amount: amount,
+            wt_types: wtTypes,
+            suggested_exchange_url: suggestedExchangeUrl
+        };
+        callWallet("taler-create-reserve", args);
+    }
+    taler.createReserve = createReserve;
+    function handlePaymentResponse(walletResp) {
         /**
-         * Confirm that a reserve was created.
+         * Handle a failed payment.
          *
-         * Used by tightly integrated bank portals.
+         * Try to notify the wallet first, before we show a potentially
+         * synchronous error message (such as an alert) or leave the page.
          */
-        function confirmReserve(reservePub) {
-            if (!installed) {
-                logVerbose && console.log("delaying confirmReserve");
-                taler.onPresent(function () {
-                    confirmReserve(reservePub);
-                });
-                return;
+        function handleFailedPayment(r) {
+            var timeoutHandle = null;
+            function err() {
+                raise_error("pay-failed", { status: r.status, response: 
r.responseText });
             }
-            callWallet("taler-confirm-reserve", { reserve_pub: reservePub });
-        }
-        taler.confirmReserve = confirmReserve;
-        function createReserve(callbackUrl, amount, wtTypes, 
suggestedExchangeUrl) {
-            if (!installed) {
-                logVerbose && console.log("delaying createReserve");
-                taler.onPresent(function () {
-                    createReserve(callbackUrl, amount, wtTypes, 
suggestedExchangeUrl);
-                });
-                return;
+            function onResp() {
+                if (timeoutHandle != null) {
+                    clearTimeout(timeoutHandle);
+                    timeoutHandle = null;
+                }
+                err();
             }
-            var args = {
-                callback_url: callbackUrl,
-                amount: amount,
-                wt_types: wtTypes,
-                suggested_exchange_url: suggestedExchangeUrl
-            };
-            callWallet("taler-create-reserve", args);
+            function onTimeout() {
+                timeoutHandle = null;
+                err();
+            }
+            callWallet("taler-payment-failed", { H_contract: 
walletResp.H_contract }, onResp);
+            timeoutHandle = setTimeout(onTimeout, 200);
         }
-        taler.createReserve = createReserve;
-        function handlePaymentResponse(walletResp) {
-            /**
-             * Handle a failed payment.
-             *
-             * Try to notify the wallet first, before we show a potentially
-             * synchronous error message (such as an alert) or leave the page.
-             */
-            function handleFailedPayment(r) {
-                var timeoutHandle = null;
-                function err() {
-                    raise_error("pay-failed", { status: r.status, response: 
r.responseText });
+        logVerbose && console.log("handling taler-notify-payment: ", 
walletResp);
+        // Payment timeout in ms.
+        var timeout_ms = 1000;
+        // Current request.
+        var r;
+        var timeoutHandle = null;
+        function sendPay() {
+            r = new XMLHttpRequest();
+            r.open("post", walletResp.contract.pay_url);
+            r.setRequestHeader("Content-Type", 
"application/json;charset=UTF-8");
+            r.send(JSON.stringify(walletResp.payReq));
+            r.onload = function () {
+                if (!r) {
+                    return;
                 }
-                function onResp() {
-                    if (timeoutHandle != null) {
-                        clearTimeout(timeoutHandle);
-                        timeoutHandle = null;
-                    }
-                    err();
+                switch (r.status) {
+                    case 200:
+                        var merchantResp = JSON.parse(r.responseText);
+                        logVerbose && console.log("got success from pay_url");
+                        callWallet("taler-payment-succeeded", { H_contract: 
walletResp.H_contract, merchantSig: merchantResp.sig }, function () {
+                            var nextUrl = walletResp.contract.fulfillment_url;
+                            logVerbose && console.log("taler-payment-succeeded 
done, going to", nextUrl);
+                            window.location.href = nextUrl;
+                            window.location.reload(true);
+                        });
+                        break;
+                    default:
+                        handleFailedPayment(r);
+                        break;
                 }
-                function onTimeout() {
+                r = null;
+                if (timeoutHandle != null) {
+                    clearTimeout(timeoutHandle);
                     timeoutHandle = null;
-                    err();
                 }
-                callWallet("taler-payment-failed", { H_contract: 
walletResp.H_contract }, onResp);
-                timeoutHandle = setTimeout(onTimeout, 200);
-            }
-            logVerbose && console.log("handling taler-notify-payment: ", 
walletResp);
-            // Payment timeout in ms.
-            var timeout_ms = 1000;
-            // Current request.
-            var r;
-            var timeoutHandle = null;
-            function sendPay() {
-                r = new XMLHttpRequest();
-                r.open("post", walletResp.contract.pay_url);
-                r.setRequestHeader("Content-Type", 
"application/json;charset=UTF-8");
-                r.send(JSON.stringify(walletResp.payReq));
-                r.onload = function () {
-                    if (!r) {
-                        return;
-                    }
-                    switch (r.status) {
-                        case 200:
-                            var merchantResp = JSON.parse(r.responseText);
-                            logVerbose && console.log("got success from 
pay_url");
-                            callWallet("taler-payment-succeeded", { 
H_contract: walletResp.H_contract, merchantSig: merchantResp.sig }, function () 
{
-                                var nextUrl = 
walletResp.contract.fulfillment_url;
-                                logVerbose && 
console.log("taler-payment-succeeded done, going to", nextUrl);
-                                window.location.href = nextUrl;
-                                window.location.reload(true);
-                            });
-                            break;
-                        default:
-                            handleFailedPayment(r);
-                            break;
-                    }
+            };
+            function retry() {
+                if (r) {
+                    r.abort();
                     r = null;
-                    if (timeoutHandle != null) {
-                        clearTimeout(timeoutHandle);
-                        timeoutHandle = null;
-                    }
-                };
-                function retry() {
-                    if (r) {
-                        r.abort();
-                        r = null;
-                    }
-                    timeout_ms = Math.min(timeout_ms * 2, 10 * 1000);
-                    logVerbose && console.log("sendPay timed out, retrying in 
", timeout_ms, "ms");
-                    sendPay();
                 }
-                timeoutHandle = setTimeout(retry, timeout_ms);
+                timeout_ms = Math.min(timeout_ms * 2, 10 * 1000);
+                logVerbose && console.log("sendPay timed out, retrying in ", 
timeout_ms, "ms");
+                sendPay();
             }
-            sendPay();
+            timeoutHandle = setTimeout(retry, timeout_ms);
         }
-        function onPresent(f) {
-            presentHandlers.push(f);
-        }
-        taler.onPresent = onPresent;
-        function onAbsent(f) {
-            absentHandlers.push(f);
+        sendPay();
+    }
+    function onPresent(f) {
+        presentHandlers.push(f);
+    }
+    taler.onPresent = onPresent;
+    function onAbsent(f) {
+        absentHandlers.push(f);
+    }
+    taler.onAbsent = onAbsent;
+    function internalPay(p) {
+        // either the callback gets called,
+        // or the wallet will redirect the browser
+        callWallet("taler-pay", p, handlePaymentResponse);
+    }
+    taler.internalPay = internalPay;
+    function pay(p) {
+        if (!installed) {
+            logVerbose && console.log("delaying call to 'pay' until GNU Taler 
wallet is present");
+            taler.onPresent(function () {
+                pay(p);
+            });
+            return;
         }
-        taler.onAbsent = onAbsent;
-        function internalPay(p) {
-            // either the callback gets called,
-            // or the wallet will redirect the browser
-            callWallet("taler-pay", p, handlePaymentResponse);
+        internalPay(p);
+    }
+    taler.pay = pay;
+    function internalAddAuditor(d) {
+        // either the callback gets called,
+        // or the wallet will redirect the browser
+        callWallet("taler-add-auditor", d);
+    }
+    taler.internalAddAuditor = internalAddAuditor;
+    function addAuditor(d) {
+        if (!installed) {
+            logVerbose && console.log("delaying call to 'addAuditor' until GNU 
Taler wallet is present");
+            taler.onPresent(function () {
+                addAuditor(d);
+            });
+            return;
         }
-        taler.internalPay = internalPay;
-        function pay(p) {
-            if (!installed) {
-                logVerbose && console.log("delaying call to 'pay' until GNU 
Taler wallet is present");
+        internalAddAuditor(d);
+    }
+    taler.addAuditor = addAuditor;
+    function internalCheckAuditor(url) {
+        return new Promise(function (resolve, reject) {
+            callWallet("taler-check-auditor", url, function (x) { return 
resolve(x); });
+        });
+    }
+    taler.internalCheckAuditor = internalCheckAuditor;
+    /**
+     * Check if an auditor is already added to the wallet.
+     *
+     * Same-origin restrictions apply.
+     */
+    function checkAuditor(url) {
+        if (!installed) {
+            logVerbose && console.log("delaying call to 'checkAuditor' until 
GNU Taler wallet is present");
+            return new Promise(function (resolve, reject) {
                 taler.onPresent(function () {
-                    pay(p);
+                    resolve(checkAuditor(url));
                 });
-                return;
-            }
-            internalPay(p);
+            });
         }
-        taler.pay = pay;
-        function internalAddAuditor(d) {
-            // either the callback gets called,
-            // or the wallet will redirect the browser
-            callWallet("taler-add-auditor", d);
+        return internalCheckAuditor(url);
+    }
+    taler.checkAuditor = checkAuditor;
+    function initTaler() {
+        function handleUninstall() {
+            installed = false;
+            // not really true, but we want "uninstalled" to be shown
+            firstTimeoutCalled = true;
+            announce();
         }
-        taler.internalAddAuditor = internalAddAuditor;
-        function addAuditor(d) {
+        function handleProbe() {
+            probeExecuted = true;
             if (!installed) {
-                logVerbose && console.log("delaying call to 'addAuditor' until 
GNU Taler wallet is present");
-                taler.onPresent(function () {
-                    addAuditor(d);
-                });
-                return;
+                logVerbose && console.log("taler install detected");
+                installed = true;
+                announce();
             }
-            internalAddAuditor(d);
         }
-        taler.addAuditor = addAuditor;
-        function internalCheckAuditor(url) {
-            return new Promise(function (resolve, reject) {
-                callWallet("taler-check-auditor", url, function (x) { return 
resolve(x); });
-            });
+        function probeTaler() {
+            probeExecuted = false;
+            var eve = new Event("taler-probe");
+            document.dispatchEvent(eve);
         }
-        taler.internalCheckAuditor = internalCheckAuditor;
-        /**
-         * Check if an auditor is already added to the wallet.
-         *
-         * Same-origin restrictions apply.
-         */
-        function checkAuditor(url) {
-            if (!installed) {
-                logVerbose && console.log("delaying call to 'checkAuditor' 
until GNU Taler wallet is present");
-                return new Promise(function (resolve, reject) {
-                    taler.onPresent(function () {
-                        resolve(checkAuditor(url));
-                    });
-                });
-            }
-            return internalCheckAuditor(url);
-        }
-        taler.checkAuditor = checkAuditor;
-        function initTaler() {
-            function handleUninstall() {
-                installed = false;
-                // not really true, but we want "uninstalled" to be shown
-                firstTimeoutCalled = true;
-                announce();
-            }
-            function handleProbe() {
-                probeExecuted = true;
-                if (!installed) {
-                    logVerbose && console.log("taler install detected");
-                    installed = true;
+        var firstTimeoutCalled = false;
+        function onProbeTimeout() {
+            if (!probeExecuted) {
+                if (installed || !firstTimeoutCalled) {
+                    installed = false;
+                    firstTimeoutCalled = true;
+                    logVerbose && console.log("taler uninstall detected");
                     announce();
                 }
             }
-            function probeTaler() {
-                probeExecuted = false;
-                var eve = new Event("taler-probe");
-                document.dispatchEvent(eve);
+            // try again, maybe it'll be installed ...
+            probeTaler();
+        }
+        /**
+         * Announce presence/absence and update stylesheets.
+         *
+         * Only called after document.readyState is at least "interactive".
+         */
+        function announce() {
+            if (!pageLoaded) {
+                logVerbose && console.log("page not loaded yet, announcing 
later");
+                return;
             }
-            var firstTimeoutCalled = false;
-            function onProbeTimeout() {
-                if (!probeExecuted) {
-                    if (installed || !firstTimeoutCalled) {
-                        installed = false;
-                        firstTimeoutCalled = true;
-                        logVerbose && console.log("taler uninstall detected");
-                        announce();
-                    }
+            setStyles();
+            if (installed) {
+                logVerbose && console.log("announcing installed");
+                for (var i = 0; i < presentHandlers.length; i++) {
+                    presentHandlers[i]();
                 }
-                // try again, maybe it'll be installed ...
-                probeTaler();
             }
-            /**
-             * Announce presence/absence and update stylesheets.
-             *
-             * Only called after document.readyState is at least "interactive".
-             */
-            function announce() {
-                if (!pageLoaded) {
-                    logVerbose && console.log("page not loaded yet, announcing 
later");
-                    return;
-                }
-                setStyles();
-                if (installed) {
-                    logVerbose && console.log("announcing installed");
-                    for (var i = 0; i < presentHandlers.length; i++) {
-                        presentHandlers[i]();
+            else {
+                if (firstTimeoutCalled) {
+                    logVerbose && console.log("announcing uninstalled");
+                    for (var i = 0; i < absentHandlers.length; i++) {
+                        absentHandlers[i]();
                     }
                 }
                 else {
-                    if (firstTimeoutCalled) {
-                        logVerbose && console.log("announcing uninstalled");
-                        for (var i = 0; i < absentHandlers.length; i++) {
-                            absentHandlers[i]();
-                        }
-                    }
-                    else {
-                        logVerbose && console.log("announcing nothing");
-                    }
+                    logVerbose && console.log("announcing nothing");
                 }
             }
-            function setStyles() {
-                if (!sheet || !sheet.cssRules) {
-                    return;
-                }
-                while (sheet.cssRules.length > 0) {
-                    sheet.deleteRule(0);
-                }
-                if (installed) {
-                    sheet.insertRule(".taler-installed-hide { display: none; 
}", 0);
+        }
+        function setStyles() {
+            if (!sheet || !sheet.cssRules) {
+                return;
+            }
+            while (sheet.cssRules.length > 0) {
+                sheet.deleteRule(0);
+            }
+            if (installed) {
+                sheet.insertRule(".taler-installed-hide { display: none; }", 
0);
+                sheet.insertRule(".taler-probed-hide { display: none; }", 0);
+            }
+            else {
+                sheet.insertRule(".taler-installed-show { display: none; }", 
0);
+                if (firstTimeoutCalled) {
                     sheet.insertRule(".taler-probed-hide { display: none; }", 
0);
                 }
                 else {
-                    sheet.insertRule(".taler-installed-show { display: none; 
}", 0);
-                    if (firstTimeoutCalled) {
-                        sheet.insertRule(".taler-probed-hide { display: none; 
}", 0);
-                    }
-                    else {
-                        // We're still doing the detection
-                        sheet.insertRule(".taler-installed-hide { display: 
none; }", 0);
-                    }
+                    // We're still doing the detection
+                    sheet.insertRule(".taler-installed-hide { display: none; 
}", 0);
                 }
             }
-            function initStyle() {
-                logVerbose && console.log("taking over styles");
-                var name = "taler-presence-stylesheet";
-                var content = "/* Taler stylesheet controlled by JS */";
-                var style = document.getElementById(name);
-                if (!style) {
-                    style = document.createElement("style");
-                    // Needed by WebKit
-                    style.appendChild(document.createTextNode(content));
-                    style.id = name;
-                    document.head.appendChild(style);
-                    sheet = style.sheet;
-                }
-                else {
-                    // We've taken over the stylesheet now,
-                    // make it clear by clearing all the rules in it
-                    // and making it obvious in the DOM.
-                    if (style.tagName.toLowerCase() === "style") {
-                        style.innerText = content;
-                    }
-                    if (!style.sheet) {
-                        throw Error("taler-presence-stylesheet should be a 
style sheet (<link> or <style>)");
-                    }
-                    sheet = style.sheet;
-                    while (sheet.cssRules.length > 0) {
-                        sheet.deleteRule(0);
-                    }
-                }
+        }
+        function initStyle() {
+            logVerbose && console.log("taking over styles");
+            var name = "taler-presence-stylesheet";
+            var content = "/* Taler stylesheet controlled by JS */";
+            var style = document.getElementById(name);
+            if (!style) {
+                style = document.createElement("style");
+                // Needed by WebKit
+                style.appendChild(document.createTextNode(content));
+                style.id = name;
+                document.head.appendChild(style);
+                sheet = style.sheet;
             }
-            function onPageLoad() {
-                pageLoaded = true;
-                if (document.readyState == "complete") {
-                    initStyle();
+            else {
+                // We've taken over the stylesheet now,
+                // make it clear by clearing all the rules in it
+                // and making it obvious in the DOM.
+                if (style.tagName.toLowerCase() === "style") {
+                    style.innerText = content;
                 }
-                else {
-                    var listener = function () {
-                        initStyle();
-                        setStyles();
-                    };
-                    window.addEventListener("load", listener);
+                if (!style.sheet) {
+                    throw Error("taler-presence-stylesheet should be a style 
sheet (<link> or <style>)");
+                }
+                sheet = style.sheet;
+                while (sheet.cssRules.length > 0) {
+                    sheet.deleteRule(0);
                 }
-                // We only start the timeout after the page is interactive.
-                window.setInterval(onProbeTimeout, 300);
-                announce();
             }
-            probeTaler();
-            document.addEventListener("taler-probe-result", handleProbe, 
false);
-            document.addEventListener("taler-uninstall", handleUninstall, 
false);
-            // Handle the case where the JavaScript is loaded after the page
-            // has been loaded for the first time.
-            if (document.readyState == "loading") {
-                document.addEventListener("DOMContentLoaded", onPageLoad, 
false);
+        }
+        function onPageLoad() {
+            pageLoaded = true;
+            if (document.readyState == "complete") {
+                initStyle();
             }
             else {
-                onPageLoad();
-            }
-        }
-        function onPageLoadInExtension() {
-            if (document.documentElement.getAttribute("data-taler-nojs")) {
-                logVerbose && console.log("doing taler initialization from 
extension (nojs)");
-                initTaler();
+                var listener = function () {
+                    initStyle();
+                    setStyles();
+                };
+                window.addEventListener("load", listener);
             }
+            // We only start the timeout after the page is interactive.
+            window.setInterval(onProbeTimeout, 300);
+            announce();
         }
-        var caught = false;
-        try {
-            chrome.runtime.sendMessage({ type: "ping" });
+        probeTaler();
+        document.addEventListener("taler-probe-result", handleProbe, false);
+        document.addEventListener("taler-uninstall", handleUninstall, false);
+        // Handle the case where the JavaScript is loaded after the page
+        // has been loaded for the first time.
+        if (document.readyState == "loading") {
+            document.addEventListener("DOMContentLoaded", onPageLoad, false);
         }
-        catch (e) {
-            caught = true;
+        else {
+            onPageLoad();
         }
-        if (caught) {
-            logVerbose && console.log("running taler-wallet-lib from page");
+    }
+    function onPageLoadInExtension() {
+        if (document.documentElement.getAttribute("data-taler-nojs")) {
+            logVerbose && console.log("doing taler initialization from 
extension (nojs)");
             initTaler();
         }
+    }
+    var caught = false;
+    try {
+        chrome.runtime.sendMessage({ type: "ping" });
+    }
+    catch (e) {
+        caught = true;
+    }
+    if (caught) {
+        logVerbose && console.log("running taler-wallet-lib from page");
+        initTaler();
+    }
+    else {
+        logVerbose && console.log("running taler-wallet-lib from extension");
+        runningInExtension = true;
+        // Wait for even style sheets to load
+        if (document.readyState != "complete") {
+            window.addEventListener("load", function () { return 
onPageLoadInExtension(); });
+        }
         else {
-            logVerbose && console.log("running taler-wallet-lib from 
extension");
-            runningInExtension = true;
-            // Wait for even style sheets to load
-            if (document.readyState != "complete") {
-                window.addEventListener("load", function () { return 
onPageLoadInExtension(); });
-            }
-            else {
-                onPageLoadInExtension();
-            }
+            onPageLoadInExtension();
         }
-    })(taler = exports.taler || (exports.taler = {}));
-});
+    }
+})(taler || (taler = {}));
 // @license-end
diff --git a/taler-wallet-lib.ts b/taler-wallet-lib.ts
index cbf32e8..1a56e95 100644
--- a/taler-wallet-lib.ts
+++ b/taler-wallet-lib.ts
@@ -28,8 +28,7 @@
   @author Florian Dold
 */
 
-
-export namespace taler {
+namespace taler {
   "use strict";
 
   let logVerbose: boolean = false;
diff --git a/tsconfig.json b/tsconfig.json
index 7d51196..1a14563 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,7 +2,6 @@
   "compilerOptions": {
     "target": "es3",
     "jsx": "react",
-    "module": "umd",
     "experimentalDecorators": true,
     "noImplicitReturns": true,
     "noFallthroughCasesInSwitch": true,

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



reply via email to

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