diff options
author | cTn <ctndesigner@gmail.com> | 2014-08-10 08:01:44 +0400 |
---|---|---|
committer | cTn <ctndesigner@gmail.com> | 2014-08-10 08:01:44 +0400 |
commit | ec44b77ff2f0e9acb683e8a431098254cd5a0dd2 (patch) | |
tree | 62c5299d84addecda418438866f7a2384cfa6656 /eventPage.js | |
parent | 377853b58a86bf232d27c639a58be7b9afcdf603 (diff) |
lots of work on removing global variables
Diffstat (limited to 'eventPage.js')
-rw-r--r-- | eventPage.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/eventPage.js b/eventPage.js index 85b97414..2d4d7b62 100644 --- a/eventPage.js +++ b/eventPage.js @@ -18,14 +18,14 @@ function start_app() { minWidth: 974, minHeight: 632 } - }, function(createdWindow) { - createdWindow.onClosed.addListener(function() { + }, function (createdWindow) { + createdWindow.onClosed.addListener(function () { // connectionId is passed from the script side through the chrome.runtime.getBackgroundPage refference // allowing us to automatically close the port when application shut down // save connectionId in separate variable before app_window is destroyed var connectionId = app_window.serial.connectionId; - var valid_connection = app_window.configuration_received; + var valid_connection = app_window.CONFIGURATOR.connectionValid; var mincommand = app_window.MISC.mincommand; if (connectionId > 0 && valid_connection) { @@ -53,13 +53,13 @@ function start_app() { bufView[5 + 16] = checksum; - chrome.serial.send(connectionId, bufferOut, function(sendInfo) { - chrome.serial.disconnect(connectionId, function(result) { + chrome.serial.send(connectionId, bufferOut, function (sendInfo) { + chrome.serial.disconnect(connectionId, function (result) { console.log('SERIAL: Connection closed - ' + result); }); }); } else if (connectionId > 0) { - chrome.serial.disconnect(connectionId, function(result) { + chrome.serial.disconnect(connectionId, function (result) { console.log('SERIAL: Connection closed - ' + result); }); } @@ -67,18 +67,18 @@ function start_app() { }); } -chrome.app.runtime.onLaunched.addListener(function() { +chrome.app.runtime.onLaunched.addListener(function () { start_app(); }); -chrome.runtime.onInstalled.addListener(function(details) { +chrome.runtime.onInstalled.addListener(function (details) { if (details.reason == 'update') { var previousVersionArr = details.previousVersion.split('.'); var currentVersionArr = chrome.runtime.getManifest().version.split('.'); // only fire up notification sequence when one of the major version numbers changed if (currentVersionArr[0] != previousVersionArr[0] || currentVersionArr[1] != previousVersionArr[1]) { - chrome.storage.local.get('update_notify', function(result) { + chrome.storage.local.get('update_notify', function (result) { if (typeof result.update_notify === 'undefined' || result.update_notify) { var manifest = chrome.runtime.getManifest(); var options = { @@ -90,7 +90,7 @@ chrome.runtime.onInstalled.addListener(function(details) { buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}] }; - chrome.notifications.create('baseflight_update', options, function(notificationId) { + chrome.notifications.create('baseflight_update', options, function (notificationId) { // empty }); } @@ -99,7 +99,7 @@ chrome.runtime.onInstalled.addListener(function(details) { } }); -chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex) { +chrome.notifications.onButtonClicked.addListener(function (notificationId, buttonIndex) { if (notificationId == 'baseflight_update') { start_app(); } |