const account = store.get("account");
if (account) launchSession(account);
-
- for (let i = 0; i < 10; i++)
- {
- setTimeout(() => {
- console.log("Testing Main to Render IPC");
- ipcEmit("test");
- }, 1000 * i)
- }
-
- ipcMain.on("test", () => console.log("Received from Render!"));
-
}
backgroundMitt.on("logout", (reason) => logout(null, reason));
<Splash v-else />`
}
-for (let i = 0; i < 30; i++)
-{
- setTimeout(() => {
- console.log("Testing Render to Main IPC.");
- window.mainApi.send("test");
- }, i * 1000);
-}
-
window.mainApi.on("account", (value, reason) => {
- console.log(value, reason);
if (reason) alert(reason);
account.value = value;
});
-window.mainApi.on("test", () => console.log("Received from Main!"));
-
export default App;
export { account };
"account",
"message",
"record",
- "ws",
- "test"
+ "ws"
];
const validToMain = [
"logout",
"encode",
"auth",
- "nav",
- "test"
+ "nav"
]
-console.log("Running Preload!");
-
ipcRenderer.setMaxListeners(250);
// Expose protected methods that allow the renderer process to use
const { backgroundMitt } = require("./utils/emitter");
let tray;
-const TRAY_PATH = "./src/assets/tray/";
+const TRAY_PATH = path.join(__dirname, "assets/tray");
/* Current state of recording, playback, and ws connection */
const state = {
* @param {"recording" | "playback" | "disconnect"} attribute
* @param {boolean} newState
*/
-function updateTray(attribute, newState) {
-
+function updateTray(attribute, newState)
+{
state[attribute] = newState;
// convert boolean to number
const bi = (b) => b ? 1 : 0;
// Make sure we have the icon we're looking for.
- tray.setImage(
- TRAY_PATH +
+ tray.setImage(path.join(
+ TRAY_PATH,
`${bi(state.recording)}${bi(state.playback)}${bi(state.disconnect)}` +
".png"
- );
-
+ ));
}
-function initTray()
+function initTray()
{
- tray = new Tray(TRAY_PATH + "000" + ".png");
+ tray = new Tray(path.join(TRAY_PATH, "000.png"));
}
exports.initTray = initTray;
{
if (win) return;
- console.log(__dirname);
-
let pos = store.get("window-position");
if (!pos) pos = { width: 350, height: 750, x: null, y: null }
minWidth: 350,
minHeight: 500,
backgroundColor: "#EBEBEB",
- webPreferences: { preload: path.join(__dirname, "/render/preload.js") }
+ webPreferences: { preload: path.join(__dirname, "render/preload.js") }
})
// TODO: find a simpler way to notify platform of user events