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


TypeScript app.quit方法代码示例

本文整理汇总了TypeScript中electron.app.quit方法的典型用法代码示例。如果您正苦于以下问题:TypeScript app.quit方法的具体用法?TypeScript app.quit怎么用?TypeScript app.quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.app的用法示例。


在下文中一共展示了app.quit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 app.on('window-all-closed', () => {
   // On OS X it is common for applications and their menu bar
   // to stay active until the user quits explicitly with Cmd + Q
   if (process.platform !== 'darwin') {
     app.quit();
   }
 });
开发者ID:mangabot,项目名称:mangabot,代码行数:7,代码来源:main.ts

示例2:

 mainWindow.on('close', (e) => {
   if (forceQuit) {
     app.quit();
   } else {
     e.preventDefault();
     mainWindow.hide();
   }
 });
开发者ID:SteveTannnnng,项目名称:Mob,代码行数:8,代码来源:main.ts

示例3:

electron.ipcMain.on("ready-to-quit", (event) => {
  if (event.sender !== mainWindow.webContents) return;

  SupAppIPC.saveAuthorizations(userDataPath);

  console.log("Exited cleanly.");
  isReadyToQuit = true;
  electron.app.quit();
});
开发者ID:nitpum,项目名称:superpowers-app,代码行数:9,代码来源:main.ts

示例4: isSquirrelEvent

    public static isSquirrelEvent(): boolean {

        if (process.argv.length === 1) {
            return false;
        }

        const path = require('path');
        const updateExe: string = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
        const execName: string = path.basename(process.execPath);

        const spawn = require('child_process').spawn;
        const runUpdater = (args: string[], done: any) => {
            return spawn(updateExe, args, { detached: true }).on('close', done);
        };

        const app = require('electron').app;
        switch (process.argv[1]) {
            case '--squirrel-install':
            case '--squirrel-updated':
                // Optionally do things such as: 
                // - Add your .exe to the PATH 
                // - Write to the registry for things like file associations and 
                //   explorer context menus 

                // Install desktop and start menu shortcuts 
                runUpdater(['--createShortcut', execName], app.quit);

                return true;

            case '--squirrel-uninstall':
                // Undo anything you did in the --squirrel-install and 
                // --squirrel-updated handlers 

                // Remove desktop and start menu shortcuts 
                runUpdater(['--removeShortcut', execName], app.quit);

                return true;

            case '--squirrel-obsolete':
                // This is called on the outgoing version of your app before 
                // we update to the new version - it's the opposite of 
                // --squirrel-updated 

                app.quit();
                return true;

            case '--squirrel-firstrun':
                // Delay to give time to the installGif to close
                let delayed = new Date().getTime() + (3 * 1000);
                while (new Date().getTime() <= delayed) {
                    // do events
                }
                return false;
        }
        return false;
    }
开发者ID:JimiC,项目名称:evetron,代码行数:56,代码来源:squirrelHandler.ts

示例5: function

    browserWindow.on("closed", function() {
        action(() =>
            windows.splice(windows.findIndex(win => win.browserWindow === browserWindow), 1)
        )();

        // if no visible window left, app can quit
        if (!windows.find(window => window.browserWindow.isVisible())) {
            app.quit();
        }
    });
开发者ID:eez-open,项目名称:studio,代码行数:10,代码来源:window.ts

示例6:

		app.on('window-all-closed', () => {
			env.log('Lifecycle#window-all-closed');

			// Windows/Linux: we quit when all windows have closed
			// Mac: we only quit when quit was requested
			// Tests: we always quit
			if (this.quitRequested || process.platform !== 'darwin') {
				app.quit();
			}
		});
开发者ID:BMGburger,项目名称:vscode,代码行数:10,代码来源:lifecycle.ts

示例7:

		app.on('window-all-closed', () => {
			env.log('Lifecycle#window-all-closed');

			// Windows/Linux: we quit when all windows have closed
			// Mac: we only quit when quit was requested
			// --wait: we quit when all windows are closed
			if (this.quitRequested || process.platform !== 'darwin' || env.cliArgs.waitForWindowClose) {
				app.quit();
			}
		});
开发者ID:carhero,项目名称:vscode,代码行数:10,代码来源:lifecycle.ts

示例8:

        app.on("window-all-closed", () => {

            // On macOS it is common for applications and their menu bar
            // to stay active until the user quits explicitly with Cmd + Q
            // if (process.platform !== "darwin") {
            //     app.quit();
            // }

            app.quit();

        });
开发者ID:hmenager,项目名称:composer,代码行数:11,代码来源:main.common.ts

示例9: setupTrayOrDock

      i18n.load([ "startup", "tray" ], () => {
        if (dataPathErr != null) {
          electron.dialog.showErrorBox(i18n.t("startup:failedToStart"), i18n.t(dataPathErr.key, dataPathErr.variables));
          electron.app.quit();
          process.exit(1);
          return;
        }

        setupTrayOrDock();
        setupMainWindow();
      });
开发者ID:AgileJoshua,项目名称:superpowers-app,代码行数:11,代码来源:main.ts

示例10:

Electron.app.on("window-all-closed", () => {
  config.save();
  environment.save();
  repoSessions.dispose();
  const devtools = Electron.BrowserWindow.getDevToolsExtensions() as {
    [name: string]: any;
  };
  Object.keys(devtools).map(Electron.BrowserWindow.removeDevToolsExtension);
  if (process.platform !== "darwin") {
    Electron.app.quit();
  }
});
开发者ID:wonderful-panda,项目名称:inazuma,代码行数:12,代码来源:main.ts


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