1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +03:00

fix error for require

This commit is contained in:
Sergej Pozdnyakov 2017-12-26 20:04:13 +03:00
parent db002fb1f5
commit cacc4522c2

50
main.js
View file

@ -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;
}
});
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');
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;
}
});
this.hide(); // Pretend to be closed already
console.log("We're closing...");
this.close(true);
});
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);
});
} else {
console.log('Not load require');
}
chrome.storage.local.get('logopen', function (result) {
if (result.logopen) {