本文整理汇总了TypeScript中electron.app.relaunch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript app.relaunch方法的具体用法?TypeScript app.relaunch怎么用?TypeScript app.relaunch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.app
的用法示例。
在下文中一共展示了app.relaunch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
response => {
// If restart was clicked (index of 0), restart the app
if (response === 0) {
app.relaunch()
app.quit()
}
}
示例2: quit
const relaunch = () => {
if (EnvironmentUtil.platform.IS_MAC_OS) {
/* on MacOS, it is not possible to relaunch the app, so just fallback
* to reloading all the webviews
* see: https://github.com/electron/electron/issues/13696
*/
WindowManager.sendActionToPrimaryWindow(EVENT_TYPE.WRAPPER.RELOAD);
} else {
app.relaunch();
quit();
}
};
示例3:
response => {
if (response === 0) {
app.relaunch();
app.quit();
}
}
示例4: updateMenu
export default async function updateMenu(): Promise<Menu> {
const newConversationItem: MenuItemConstructorOptions = {
label: 'New Conversation',
accelerator: 'CommandOrControl+N',
click() {
sendAction('new-conversation');
}
};
const switchItems: MenuItemConstructorOptions[] = [
{
label: 'Switch to Work Chat…',
accelerator: 'CommandOrControl+Shift+2',
visible: !config.get('useWorkChat'),
click() {
config.set('useWorkChat', true);
app.relaunch();
app.quit();
}
},
{
label: 'Switch to Messenger…',
accelerator: 'CommandOrControl+Shift+1',
visible: config.get('useWorkChat'),
click() {
config.set('useWorkChat', false);
app.relaunch();
app.quit();
}
},
{
label: 'Log Out',
click() {
sendAction('log-out');
}
}
];
const vibrancySubmenu: MenuItemConstructorOptions[] = [
{
label: 'No Vibrancy',
type: 'checkbox',
checked: config.get('vibrancy') === 'none',
async click() {
config.set('vibrancy', 'none');
sendAction('update-vibrancy');
await updateMenu();
}
},
{
label: 'Sidebar-only Vibrancy',
type: 'checkbox',
checked: config.get('vibrancy') === 'sidebar',
async click() {
config.set('vibrancy', 'sidebar');
sendAction('update-vibrancy');
await updateMenu();
}
},
{
label: 'Full-window Vibrancy',
type: 'checkbox',
checked: config.get('vibrancy') === 'full',
async click() {
config.set('vibrancy', 'full');
sendAction('update-vibrancy');
await updateMenu();
}
}
];
const privacySubmenu: MenuItemConstructorOptions[] = [
{
label: 'Block Seen Indicator',
type: 'checkbox',
checked: config.get('block.chatSeen'),
click(menuItem) {
config.set('block.chatSeen', menuItem.checked);
}
},
{
label: 'Block Typing Indicator',
type: 'checkbox',
checked: config.get('block.typingIndicator'),
click(menuItem) {
config.set('block.typingIndicator', menuItem.checked);
}
},
{
label: 'Block Delivery Receipts',
type: 'checkbox',
checked: config.get('block.deliveryReceipt'),
click(menuItem) {
config.set('block.deliveryReceipt', menuItem.checked);
}
}
];
const advancedSubmenu: MenuItemConstructorOptions[] = [
{
//.........这里部分代码省略.........
示例5:
'Click here to install and relaunch now', () => {
app.relaunch();
autoUpdater.quitAndInstall();
});
示例6:
ipcMain.on("restartApp", () => {
isRestarting = true;
app.relaunch();
app.quit();
});
示例7:
crashWindow.onClose(() => {
if (!__DEV__) {
app.relaunch()
}
app.quit()
})
示例8: click
shell.openExternal(
'https://github.com/timche/gmail-desktop/issues/new/choose'
)
}
}
]
}
]
// Add the develop menu when running in the development environment
if (is.development) {
darwinMenu.splice(-1, 0, {
label: 'Develop',
submenu: [
{
label: 'Clear Cache and Restart',
click() {
// Clear app config
appConfig.deleteAll()
// Restart without firing quitting events
app.relaunch()
app.exit(0)
}
}
]
})
}
const menu = Menu.buildFromTemplate(darwinMenu)
export default menu