本文整理匯總了TypeScript中electron.powerSaveBlocker.stop方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript powerSaveBlocker.stop方法的具體用法?TypeScript powerSaveBlocker.stop怎麽用?TypeScript powerSaveBlocker.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.powerSaveBlocker
的用法示例。
在下文中一共展示了powerSaveBlocker.stop方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
//.........這裏部分代碼省略.........
},
buttons: [
{
label: ["prompt.action.continue"],
action: actions.modalResponse({
continue: true,
}),
},
"cancel",
],
})
);
if (res) {
return { continue: true };
}
return { continue: false };
});
client.on(messages.PrereqsEnded, async () => {
closePrereqsModal();
});
client.on(messages.LaunchWindowShouldBeForeground, async ({ hwnd }) => {
try {
require("asfw").SetForegroundWindow(hwnd);
} catch (e) {
logger.warn(`Could not set foreground window: ${e.stack}`);
}
});
client.on(messages.LaunchRunning, async () => {
logger.info("Now running!");
ctx.emitProgress({ progress: 1, stage: "run" });
if (preferences.preventDisplaySleep) {
powerSaveBlockerId = powerSaveBlocker.start(
"prevent-display-sleep"
);
}
});
client.on(messages.LaunchExited, async () => {
logger.info("Exited!");
ctx.emitProgress({ progress: -1, stage: "clean" });
});
client.on(messages.AllowSandboxSetup, async () => {
let messageString: ILocalizedString = "";
let detailString: ILocalizedString = "";
if (process.platform === "win32") {
messageString = ["sandbox.setup.windows.message"];
detailString = ["sandbox.setup.windows.detail"];
} else {
messageString = ["sandbox.setup.linux.message"];
detailString = ["sandbox.setup.linux.detail"];
}
const res = await promisedModal(
store,
modalWidgets.sandboxBlessing.make({
window: "root",
title: ["sandbox.setup.title"],
message: messageString,
detail: detailString,
widgetParams: {},
buttons: [
{
label: ["sandbox.setup.proceed"],
action: modalWidgets.sandboxBlessing.action({
sandboxBlessing: true,
}),
icon: "security",
},
"cancel",
],
})
);
if (res && res.sandboxBlessing) {
return { allow: true };
}
return { allow: false };
});
await client.call(messages.Launch, {
caveId: cave.id,
prereqsDir,
sandbox: preferences.isolateApps,
});
} finally {
closePrereqsModal();
client.close();
if (powerSaveBlockerId) {
powerSaveBlocker.stop(powerSaveBlockerId);
}
}
},