From c82c605656d0e88a9703c563d9480a144fb00cd9 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Fri, 30 Sep 2016 20:45:18 +0200 Subject: [PATCH] run scripts on background page after onLoad --- background/main.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/background/main.ts b/background/main.ts index 60046e733..f039f9aea 100644 --- a/background/main.ts +++ b/background/main.ts @@ -16,26 +16,27 @@ /** * Entry point for the background page. - * + * * @author Florian Dold */ "use strict"; -// TypeScript does not allow ".js" extensions in the -// module name, so SystemJS must add it. -System.config({ - defaultJSExtensions: true, - }); +window.addEventListener("load", () => { + // TypeScript does not allow ".js" extensions in the + // module name, so SystemJS must add it. + System.config({ + defaultJSExtensions: true, + }); -System.import("../lib/wallet/wxMessaging") - .then((wxMessaging) => { - // Export as global for debugger - (window as any).wxMessaging = wxMessaging; - wxMessaging.wxMain(); - }) - .catch((e) => { - console.log("wallet failed"); - console.error(e.stack); - }); + System.import("../lib/wallet/wxMessaging") + .then((wxMessaging) => { + // Export as global for debugger + (window as any).wxMessaging = wxMessaging; + wxMessaging.wxMain(); + }).catch((e) => { + console.log("wallet failed"); + console.error(e.stack); + }); +});