kopia lustrzana https://github.com/dceejay/electron-node-red
Fix electron initial load delay problem.
And serial port rebuild problempull/8/head
rodzic
cc1e9e41df
commit
6ca4fc735d
|
@ -14,7 +14,7 @@ git clone https://github.com/dceejay/electron-node-red.git
|
|||
# Go into the repository
|
||||
cd electron-node-red
|
||||
# Install dependencies and run the app
|
||||
npm install && npm start
|
||||
npm install && npm run clean && npm start
|
||||
```
|
||||
|
||||
## TLDR
|
||||
|
|
19
main.js
19
main.js
|
@ -43,10 +43,6 @@ red_app.use(settings.httpAdminRoot,RED.httpAdmin);
|
|||
// Serve the http nodes UI from /api
|
||||
red_app.use(settings.httpNodeRoot,RED.httpNode);
|
||||
|
||||
server.listen(8000);
|
||||
|
||||
// Start the runtime
|
||||
RED.start();
|
||||
|
||||
// Create the Application's main menu
|
||||
var template = [{
|
||||
|
@ -90,14 +86,11 @@ function createWindow () {
|
|||
var webContents = mainWindow.webContents;
|
||||
webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) {
|
||||
if ((httpResponseCode == 404) && (newURL == url)) {
|
||||
setTimeout(webContents.reload, 250);
|
||||
setTimeout(webContents.reload, 200);
|
||||
}
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
||||
});
|
||||
|
||||
// load the initial page
|
||||
setTimeout(function() {mainWindow.loadURL(url)}, 1000);
|
||||
|
||||
// Open the DevTools.
|
||||
//mainWindow.webContents.openDevTools();
|
||||
|
||||
|
@ -122,8 +115,7 @@ function createWindow () {
|
|||
});
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Called when Electron has finished initialization and is ready to create browser windows.
|
||||
app.on('ready', createWindow);
|
||||
|
||||
// Quit when all windows are closed.
|
||||
|
@ -142,3 +134,10 @@ app.on('activate', function () {
|
|||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
// Start the Node-RED runtime, then load the inital page
|
||||
RED.start().then(function() {
|
||||
server.listen(8000,function() {
|
||||
mainWindow.loadURL(url);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"start": "electron main.js",
|
||||
"test": "echo \" Warning: no test specified \"",
|
||||
|
||||
"clean": "rm -rf ./dist ./build && mkdir -p ./dist",
|
||||
"clean": "rm -rf ./dist ./build && mkdir -p ./dist && ./node_modules/.bin/electron-rebuild",
|
||||
|
||||
"pack": "npm run clean && electron-packager . Node-RED --icon=nodered.icns --all --out=build",
|
||||
"pack:osx": "electron-packager . Node-RED --icon=nodered.icns --platform=darwin --arch=x64 --out=build",
|
||||
|
@ -53,7 +53,8 @@
|
|||
},
|
||||
"homepage": "https://github.com/dceejay/electron-node-red#readme",
|
||||
"devDependencies": {
|
||||
"electron": "^1.4.3",
|
||||
"electron": "^1.4.4",
|
||||
"electron-rebuild": "*",
|
||||
"electron-winstaller": "*"
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue