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


TypeScript actions.gameUpdateCheckStatus方法代码示例

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


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

示例1: async

  watcher.on(actions.checkForGameUpdates, async (store, action) => {
    reschedule(store);

    if (!store.getState().setup.done) {
      return;
    }

    store.dispatch(
      actions.gameUpdateCheckStatus({
        checking: true,
        progress: 0,
      })
    );

    try {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: true,
          progress: 0,
        })
      );

      const res = await mcall(messages.CheckUpdate, {}, convo => {
        hookLogging(convo, logger);

        convo.on(messages.GameUpdateAvailable, async ({ update }) => {
          store.dispatch(actions.gameUpdateAvailable({ update }));
        });

        convo.on(messages.Progress, async ({ progress }) => {
          store.dispatch(
            actions.gameUpdateCheckStatus({
              checking: true,
              progress,
            })
          );
        });
      });

      if (!isEmpty(res.updates)) {
        for (const update of res.updates) {
          store.dispatch(actions.gameUpdateAvailable({ update }));
        }
      }

      if (!isEmpty(res.warnings)) {
        logger.warn(`Got warnings when checking for updates: `);
        for (const w of res.warnings) {
          logger.warn(w);
        }
      }
    } finally {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: false,
          progress: -1,
        })
      );
    }
  });
开发者ID:itchio,项目名称:itch,代码行数:60,代码来源:updater.ts

示例2: async

  watcher.on(actions.checkForGameUpdates, async (store, action) => {
    reschedule(store);

    if (!store.getState().setup.done) {
      return;
    }

    store.dispatch(
      actions.gameUpdateCheckStatus({
        checking: true,
        progress: 0,
      })
    );

    try {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: true,
          progress: 0,
        })
      );

      // TODO: let butler page through the caves instead,
      // this is too much back and forth
      const { caves } = await call(messages.FetchCaves, {});

      if (isEmpty(caves)) {
        return;
      }

      logger.info(`Checking updates for ${caves.length} games`);

      let items: CheckUpdateItem[] = [];
      for (const cave of caves) {
        try {
          items.push(await prepareUpdateItem(cave));
        } catch (e) {
          logger.error(
            `Won't be able to check ${cave.id} for upgrade: ${e.stack}`
          );
        }
      }

      try {
        await performUpdateCheck(store, items);
      } catch (e) {
        logger.error(
          `While performing ${items.length} update checks: ${e.stack}`
        );
      }
    } finally {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: false,
          progress: -1,
        })
      );
    }
  });
开发者ID:HorrerGames,项目名称:itch,代码行数:59,代码来源:updater.ts


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