2020-12-12 11:56:28 +01:00
|
|
|
"use strict";
|
2020-06-27 21:02:48 +02:00
|
|
|
|
|
|
|
const electron = require('electron');
|
|
|
|
|
|
|
|
const {
|
|
|
|
POWER_SAVE_BLOCKER_BLOCK_DISPLAY_SLEEP,
|
|
|
|
POWER_SAVE_BLOCKER_UNBLOCK_DISPLAY_SLEEP,
|
|
|
|
POWER_SAVE_BLOCKER_CLEANUP_DISPLAY_SLEEP
|
|
|
|
} = require('../common/constants').IPCEvents;
|
|
|
|
|
2020-12-12 11:56:28 +01:00
|
|
|
async function blockDisplaySleep() {
|
|
|
|
return electron.ipcRenderer.invoke(POWER_SAVE_BLOCKER_BLOCK_DISPLAY_SLEEP);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function unblockDisplaySleep(id) {
|
|
|
|
return electron.ipcRenderer.invoke(POWER_SAVE_BLOCKER_UNBLOCK_DISPLAY_SLEEP, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function cleanupDisplaySleep() {
|
|
|
|
return electron.ipcRenderer.invoke(POWER_SAVE_BLOCKER_CLEANUP_DISPLAY_SLEEP);
|
|
|
|
}
|
|
|
|
|
2020-06-27 21:02:48 +02:00
|
|
|
module.exports = {
|
|
|
|
blockDisplaySleep,
|
|
|
|
unblockDisplaySleep,
|
|
|
|
cleanupDisplaySleep
|
|
|
|
};
|