diff --git a/src/js/dial.js b/src/js/dial.js index 3354e65..dab39c9 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -6,10 +6,22 @@ var dial = { }; window.onload = function(){ - browser.runtime.getBackgroundPage().then(function(page){ - app = page.app; - dial.initUI(); - }, function(){}); + function initPage(){ + browser.runtime.getBackgroundPage().then(function(page){ + if(page.app.settings){ + app = page.app; + dial.initUI(); + browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ + switch(request.command){ + case 'gridNodesSynced': + if(app.settings) dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); + break; + } + }); + } else initPage(); + }, function(){}); + } + initPage(); } window.onresize = function(){ if(app && app.settings) dial.updateGridLayout(dial.Grid, app.settings.grid, dial.styles.grid); @@ -29,13 +41,6 @@ window.onwheel = function(ev){ } } } -browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ - switch(request.command){ - case 'gridNodesSynced': - if(app.settings) dial.populateGrid(dial.Grid, app.settings.grid, dial.Node); - break; - } -}); dial.initUI = function(){ diff --git a/src/manifest.json b/src/manifest.json index 1edfc9f..b4c74b1 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "0.0.3", + "version": "0.0.4", "description": "__MSG_extensionDescription__",