Skip to content

Commit

Permalink
fix: reload content when unload screen
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Feb 11, 2022
1 parent aa10db2 commit a41178d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow } = require("electron");
const { app, BrowserWindow, powerMonitor } = require("electron");
const path = require("path");
const WinState = require("electron-win-state").default;
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
Expand All @@ -20,6 +20,10 @@ const createWindow = () => {
mainWindow.setPosition(mainWindow.getPosition()[0], 0);
// and load the index.html of the app.
mainWindow.loadFile(path.join(__dirname, "index.html"));

powerMonitor.on("unlock-screen", () => {
mainWindow.webContents.reload();
});
};

// This method will be called when Electron has finished
Expand Down

0 comments on commit a41178d

Please sign in to comment.