當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。