当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript app.relaunch方法代码示例

本文整理汇总了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()
   }
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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();
  }
};
开发者ID:wireapp,项目名称:wire-desktop,代码行数:12,代码来源:lifecycle.ts

示例3:

		response => {
			if (response === 0) {
				app.relaunch();
				app.quit();
			}
		}
开发者ID:kusamakura,项目名称:caprine,代码行数:6,代码来源:util.ts

示例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[] = [
		{
//.........这里部分代码省略.........
开发者ID:nikteg,项目名称:caprine,代码行数:101,代码来源:menu.ts

示例5:

							'Click here to install and relaunch now', () => {
								app.relaunch();
								autoUpdater.quitAndInstall();
							});
开发者ID:SanderRonde,项目名称:youtube-music-app,代码行数:4,代码来源:updater.ts

示例6:

ipcMain.on("restartApp", () => {
  isRestarting = true;
  app.relaunch();
  app.quit();
});
开发者ID:stargeizer,项目名称:noia-node-gui,代码行数:5,代码来源:main.ts

示例7:

 crashWindow.onClose(() => {
   if (!__DEV__) {
     app.relaunch()
   }
   app.quit()
 })
开发者ID:Ahskys,项目名称:desktop,代码行数:6,代码来源:show-uncaught-exception.ts

示例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
开发者ID:,项目名称:,代码行数:30,代码来源:


注:本文中的electron.app.relaunch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。