Adds tests for action creators and reducers
This commit is contained in:
@@ -4,18 +4,26 @@ const { Controller, Tag } = require("ethernet-ip");
|
||||
const _ = require("lodash");
|
||||
const { app, BrowserWindow, ipcMain } = electron;
|
||||
|
||||
const tagList = require("./tagList.json");
|
||||
|
||||
// To avoid being garbage collected
|
||||
let mainWindow;
|
||||
let PLC;
|
||||
|
||||
const tagList = require("./tagList.json");
|
||||
|
||||
app.on("ready", () => {
|
||||
|
||||
mainWindow = new BrowserWindow({});
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 1000
|
||||
});
|
||||
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
|
||||
|
||||
initPLC("10.20.4.36", tagList.scan_list);
|
||||
// Wait for allowing react app to fully load
|
||||
// before starting to send initalized data.
|
||||
setTimeout(() => {
|
||||
initPLC("10.20.4.36", tagList.scan_list);
|
||||
}, 2000);
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -41,9 +49,11 @@ function initPLC(ipAddress, tagList){
|
||||
const properties = { ...PLC.properties, ipAddress};
|
||||
mainWindow.webContents.send("plc:connected", properties);
|
||||
PLC.scan().catch((err) => {
|
||||
mainWindow.webContents.send("plc:error", err.message);
|
||||
console.log(err);
|
||||
});
|
||||
}).catch((err) => {
|
||||
mainWindow.webContents.send("plc:error", err.message);
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
@@ -62,6 +72,7 @@ function initPLC(ipAddress, tagList){
|
||||
}
|
||||
|
||||
|
||||
|
||||
ipcMain.on("plc:initialize", (event, ipAddress, tagList) =>{
|
||||
// console.log("plc:initialize", ipAddress, tagList);
|
||||
initPLC(ipAddress, tagList);
|
||||
|
||||
Reference in New Issue
Block a user