Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergej Pozdnyakov <afinogen89@gmail.com>2017-12-26 20:04:13 +0300
committerSergej Pozdnyakov <afinogen89@gmail.com>2017-12-26 20:04:13 +0300
commitcacc4522c22a3bcd7a1eb4402f22b1809bcdc18f (patch)
tree11744e49017952c593f3b4c60a81034e5dc665dd /main.js
parentdb002fb1f5106101e14f7e3d6128fb3c88cf020f (diff)
fix error for `require`
Diffstat (limited to 'main.js')
-rw-r--r--main.js48
1 files changed, 26 insertions, 22 deletions
diff --git a/main.js b/main.js
index 5bae1164..da8095c7 100644
--- a/main.js
+++ b/main.js
@@ -38,30 +38,34 @@ $(document).ready(function () {
break;
}
- // Load native UI library
- var gui = require('nw.gui');
- var win = gui.Window.get();
- //Get saved size and position
- chrome.storage.local.get('windowSize', function (result) {
- if (result.windowSize) {
- win.height = result.windowSize.height;
- win.width = result.windowSize.width;
- win.x = result.windowSize.x;
- win.y = result.windowSize.y;
- }
- });
+ if (typeof require !== "undefined") {
+ // Load native UI library
+ var gui = require('nw.gui');
+ var win = gui.Window.get();
+ //Get saved size and position
+ chrome.storage.local.get('windowSize', function (result) {
+ if (result.windowSize) {
+ win.height = result.windowSize.height;
+ win.width = result.windowSize.width;
+ win.x = result.windowSize.x;
+ win.y = result.windowSize.y;
+ }
+ });
- win.on('close', function() {
- //Save window size and position
- var currentWin = this;
- chrome.storage.local.set({'windowSize': {height: win.height, width: win.width, x: win.x, y: win.y}}, function() {
- // Notify that we saved.
- console.log('Settings saved');
+ win.on('close', function () {
+ //Save window size and position
+ var currentWin = this;
+ chrome.storage.local.set({'windowSize': {height: win.height, width: win.width, x: win.x, y: win.y}}, function () {
+ // Notify that we saved.
+ console.log('Settings saved');
+ });
+ this.hide(); // Pretend to be closed already
+ console.log("We're closing...");
+ this.close(true);
});
- this.hide(); // Pretend to be closed already
- console.log("We're closing...");
- this.close(true);
- });
+ } else {
+ console.log('Not load require');
+ }
chrome.storage.local.get('logopen', function (result) {
if (result.logopen) {