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