当前位置: 首页>>代码示例>>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;未经允许,请勿转载。