當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript actions.quit方法代碼示例

本文整理匯總了TypeScript中common/actions.actions.quit方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript actions.quit方法的具體用法?TypeScript actions.quit怎麽用?TypeScript actions.quit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common/actions.actions的用法示例。


在下文中一共展示了actions.quit方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

  watcher.on(actions.quitWhenMain, async (store, action) => {
    const mainId = getNativeState(store.getState(), "root").id;
    const focused = BrowserWindow.getFocusedWindow();

    if (focused) {
      if (focused.id === mainId) {
        store.dispatch(actions.quit({}));
      } else {
        focused.close();
      }
    }
  });
開發者ID:HorrerGames,項目名稱:itch,代碼行數:12,代碼來源:main-window.ts

示例2: callback

          (ev, webContents, url, error, certificate, callback) => {
            // do not trust
            callback(false);

            logger.error(
              `Certificate error: ${error} issued by ${
                certificate.issuerName
              } for ${certificate.subjectName}`
            );

            // TODO: that's super annoying as a modal.

            store.dispatch(
              actions.openModal(
                modalWidgets.naked.make({
                  window: "root",
                  title: `Certificate error: ${error}`,
                  message:
                    `There was an error with the certificate for ` +
                    `\`${certificate.subjectName}\` issued by \`${
                      certificate.issuerName
                    }\`.\n\n` +
                    `Please check your proxy configuration and try again.`,
                  detail: `If you ignore this error, the rest of the app might not work correctly.`,
                  buttons: [
                    {
                      label: "Ignore and continue",
                      className: "secondary",
                    },
                    {
                      label: ["menu.file.quit"],
                      action: actions.quit({}),
                    },
                  ],
                  widgetParams: null,
                })
              )
            );
          }
開發者ID:HorrerGames,項目名稱:itch,代碼行數:39,代碼來源:preboot.ts

示例3:

 app.on("before-quit", e => {
   e.preventDefault();
   store.dispatch(actions.quit({}));
 });
開發者ID:itchio,項目名稱:itch,代碼行數:4,代碼來源:main.ts

示例4:

 process.nextTick(() => {
   store.dispatch(actions.quit({}));
 });
開發者ID:HorrerGames,項目名稱:itch,代碼行數:3,代碼來源:main-window.ts

示例5: async

  watcher.on(actions.relaunch, async (store, action) => {
    const rs = store.getState();
    const pkg = rs.broth.packages["itch-setup"];
    if (pkg.stage !== "idle") {
      logger.warn(`itch-setup: wanted pkg stage idle but got '${pkg.stage}'`);
      return;
    }

    const prefix = pkg.versionPrefix;
    if (!prefix) {
      logger.warn(`itch-setup: no prefix (not installed yet?)`);
      return;
    }

    const command = ospath.join(prefix, "itch-setup");
    const args: string[] = [
      "--appname",
      rs.system.appName,
      "--relaunch",
      "--relaunch-pid",
      `${process.pid}`,
    ];

    const stdio: any[] = ["ignore", "ignore", "ignore"];
    const logPath = relaunchLogPath();
    try {
      fs.mkdirSync(dirname(logPath));
    } catch (e) {}
    try {
      fs.unlinkSync(logPath);
    } catch (e) {}

    let out = -1;
    let err = -1;
    try {
      if (fs.existsSync(logPath)) {
        fs.unlinkSync(logPath);
      }
      out = fs.openSync(logPath, "a");
      stdio[1] = out;
      err = fs.openSync(logPath, "a");
      stdio[2] = err;
    } catch (e) {
      logger.warn(`Could not set up stdout/stderr for relaunch: ${e.stack}`);
      if (out != -1) {
        fs.closeSync(out);
      }
      if (err != -1) {
        fs.closeSync(err);
      }
    }
    const child = childProcess.spawn(command, args, {
      stdio,
      detached: true,
    });
    child.unref();

    for (let i = 0; i < 30; i++) {
      try {
        const file = fs.readFileSync(logPath, { encoding: "utf8" });
        const tokens = file.split("\n");
        for (const tok of tokens) {
          try {
            const msg = JSON.parse(tok) as ISM;
            if (msg.type === "ready-to-relaunch") {
              logger.info(`itch-setup is ready to relaunch!`);
              store.dispatch(actions.quit({}));
              return;
            }
          } catch (e) {
            // ignore
          }
        }
      } catch (e) {
        logger.warn(`While polling itch-setup log: ${e.stack}`);
      }
      await delay(250);
    }
  });
開發者ID:itchio,項目名稱:itch,代碼行數:79,代碼來源:self-update.ts

示例6:

 click: () => store.dispatch(actions.quit({})),
開發者ID:HorrerGames,項目名稱:itch,代碼行數:1,代碼來源:tray.ts

示例7: userMenu

export function userMenu(store: Store): MenuTemplate {
  return [
    {
      icon: "rocket",
      localizedLabel: ["sidebar.view_creator_profile"],
      action: actions.viewCreatorProfile({}),
    },
    {
      icon: "fire",
      localizedLabel: ["sidebar.view_community_profile"],
      action: actions.viewCommunityProfile({}),
    },
    {
      type: "separator",
    },
    {
      icon: "download",
      localizedLabel: ["sidebar.downloads"],
      id: "user-menu-downloads",
      action: actions.navigate({
        wind: "root",
        url: "itch://downloads",
      }),
      accelerator: "CmdOrCtrl+J",
    },
    {
      icon: "cog",
      localizedLabel: ["sidebar.preferences"],
      id: "user-menu-preferences",
      action: actions.navigate({
        wind: "root",
        url: "itch://preferences",
      }),
      accelerator: "CmdOrCtrl+,",
    },
    {
      type: "separator",
    },
    {
      icon: "bug",
      localizedLabel: ["menu.help.report_issue"],
      action: actions.sendFeedback({}),
    },
    {
      icon: "lifebuoy",
      localizedLabel: ["menu.help.help"],
      action: actions.navigate({ wind: "root", url: urls.manual }),
    },
    {
      type: "separator",
    },
    {
      icon: "shuffle",
      localizedLabel: ["menu.account.change_user"],
      id: "user-menu-change-user",
      action: actions.changeUser({}),
    },
    {
      icon: "exit",
      localizedLabel: ["menu.file.quit"],
      action: actions.quit({}),
      accelerator: "CmdOrCtrl+Q",
    },
  ];
}
開發者ID:itchio,項目名稱:itch,代碼行數:65,代碼來源:build-template.ts


注:本文中的common/actions.actions.quit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。