From 3043b5caf21c681fa0c92463f1ab8b22a5c3fa6f Mon Sep 17 00:00:00 2001 From: Erayd Date: Tue, 3 Apr 2018 10:19:00 +1200 Subject: [PATCH] Load settings before initializing the popup (#246) --- chrome/script.browserify.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/script.browserify.js b/chrome/script.browserify.js index 05bbcd9..0ef7521 100644 --- a/chrome/script.browserify.js +++ b/chrome/script.browserify.js @@ -12,11 +12,16 @@ var error; var domain, urlDuringSearch; var searchSettings; -m.mount(document.getElementById("mount"), { view: view, oncreate: oncreate }); +// load settings and initialise popup +chrome.runtime.sendMessage({ action: "getSettings" }, function(settings) { + searchSettings = settings; + + m.mount(document.getElementById("mount"), { view: view, oncreate: oncreate }); -chrome.tabs.onActivated.addListener(init); -chrome.tabs.query({ lastFocusedWindow: true, active: true }, function(tabs) { - init(tabs[0]); + chrome.tabs.onActivated.addListener(init); + chrome.tabs.query({ lastFocusedWindow: true, active: true }, function(tabs) { + init(tabs[0]); + }); }); function view() {