Skip to content

Commit 898c274

Browse files
author
lijiahao
committed
Optimize display sleep prevented
1 parent e427364 commit 898c274

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/background.js

Lines changed: 5 additions & 1 deletion
Large diffs are not rendered by default.

main/application.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app as ElectronApp, BrowserWindow, dialog } from "electron";
1+
import { app as ElectronApp, BrowserWindow, dialog, powerSaveBlocker } from "electron";
22
import serve from "electron-serve";
33
import Store from "electron-store";
44
import Debug from "debug";
@@ -76,6 +76,10 @@ export default class Application {
7676
this._msalAuthentication = new MsalAuthentication(this);
7777

7878
this._ipc.startUp();
79+
80+
// Prevent display from sleeping
81+
const id = powerSaveBlocker.start('prevent-display-sleep')
82+
console.log('Prevent sleep state:' + powerSaveBlocker.isStarted(id))
7983
}
8084

8185
log(namespace = "application", ...args) {

0 commit comments

Comments
 (0)