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


TypeScript actions.downloadQueued方法代碼示例

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


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

示例1: async

  watcher.on(actions.queueCaveReinstall, async (store, action) => {
    const { caveId } = action.payload;

    await mcall(messages.InstallQueue, {
      caveId,
      reason: DownloadReason.Reinstall,
      queueDownload: true,
    });
    store.dispatch(actions.downloadQueued({}));
  });
開發者ID:piak2018,項目名稱:itch,代碼行數:10,代碼來源:queue-cave-reinstall.ts

示例2: async

  watcher.on(actions.queueGameUpdate, async (store, action) => {
    const { update } = action.payload;
    const { game, upload, build } = update;

    await call(messages.InstallQueue, {
      caveId: update.itemId,
      game,
      upload,
      build,
      reason: DownloadReason.Update,
      queueDownload: true,
    });
    store.dispatch(actions.downloadQueued({}));
  });
開發者ID:HorrerGames,項目名稱:itch,代碼行數:14,代碼來源:game-updates.ts

示例3: performInstallQueue

async function performInstallQueue({
  store,
  logger,
  game,
  upload,
  build,
}: {
  store: IStore;
  logger: Logger;
  game: Game;
  upload: Upload;
  build: Build;
}) {
  const installLocationId = defaultInstallLocation(store);

  await withLogger(logger)(
    messages.InstallQueue,
    {
      game,
      upload,
      build,
      installLocationId,
      queueDownload: true,
    },
    client => {
      client.on(messages.PickUpload, async ({ uploads }) => {
        const { title } = game;

        const modalRes = await promisedModal(
          store,
          modalWidgets.pickUpload.make({
            window: "root",
            title: ["pick_install_upload.title", { title }],
            message: ["pick_install_upload.message", { title }],
            coverUrl: game.coverUrl,
            stillCoverUrl: game.stillCoverUrl,
            bigButtons: map(uploads, (candidate, index) => {
              return {
                ...makeUploadButton(candidate),
                action: modalWidgets.pickUpload.action({
                  pickedUploadIndex: index,
                }),
              };
            }),
            buttons: ["cancel"],
            widgetParams: {},
          })
        );

        if (modalRes) {
          return { index: modalRes.pickedUploadIndex };
        } else {
          // that tells butler to abort
          return { index: -1 };
        }
      });

      client.on(messages.ExternalUploadsAreBad, async () => {
        const modalRes = await promisedModal(
          store,
          modalWidgets.naked.make({
            window: "root",
            title: "Dragons be thar",
            message:
              "You've chosen to install an external upload. Those are supported poorly.",
            detail:
              "There's a chance it won't install at all.\n\nAlso, we won't be able to check for updates.",
            bigButtons: [
              {
                label: "Install it anyway",
                tags: [{ label: "Consequences be damned" }],
                icon: "fire",
                action: actions.modalResponse({}),
              },
              "nevermind",
            ],
            widgetParams: null,
          })
        );

        if (!modalRes) {
          return { whatever: false };
        }

        // ahh damn.
        return { whatever: true };
      });
    }
  );
  store.dispatch(actions.downloadQueued({}));
}
開發者ID:HorrerGames,項目名稱:itch,代碼行數:91,代碼來源:queue-game.ts


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