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


TypeScript actions.taskProgress方法代码示例

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


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

示例1:

 ctx.on("progress", (ev: IProgressInfo) => {
   store.dispatch(actions.taskProgress({ id, ...ev }));
 });
开发者ID:HorrerGames,项目名称:itch,代码行数:3,代码来源:as-task.ts

示例2: performLaunch

export async function performLaunch(
  ctx: Context,
  logger: Logger,
  cave: Cave,
  game: Game
) {
  ctx.emitProgress({ progress: -1, stage: "configure" });

  const { store } = ctx;
  const taskId = ctx.getTaskId();
  store.dispatch(
    actions.taskProgress({
      id: taskId,
      progress: -1,
      stage: "prepare",
    })
  );

  // TODO: have butler check morphing and queue a heal if needed
  const { appVersion } = store.getState().system;
  logger.info(`itch ${appVersion} launching '${game.title}' (#${game.id})`);

  const { preferences } = store.getState();
  const prereqsDir = paths.prereqsPath();

  // TODO: extract that to another module
  let prereqsModal: ITypedModal<any, any>;
  let prereqsStateParams: IPrereqsStateParams;

  function closePrereqsModal() {
    if (!prereqsModal) {
      return;
    }

    store.dispatch(
      actions.closeModal({
        window: "root",
        id: prereqsModal.id,
      })
    );
    prereqsModal = null;
  }

  let powerSaveBlockerId = null;

  let client: Client;
  let cancelled = false;

  await ctx.withStopper({
    work: async () => {
      client = new Client(store.getState().butlerd.endpoint);
      await client.connect();
      try {
        setupClient(client, logger, ctx);

        client.on(messages.PickManifestAction, async ({ actions }) => {
          const index = await pickManifestAction(store, actions, game);
          return { index };
        });

        client.on(messages.HTMLLaunch, async params => {
          return await performHTMLLaunch({
            ctx,
            logger,
            game,
            params,
          });
        });

        client.on(messages.ShellLaunch, async ({ itemPath }) => {
          shell.openItem(itemPath);
          return {};
        });

        client.on(messages.URLLaunch, async ({ url }) => {
          store.dispatch(actions.navigate({ window: "root", url }));
          return {};
        });

        client.on(messages.PrereqsStarted, async ({ tasks }) => {
          prereqsStateParams = {
            gameTitle: game.title,
            tasks: {},
          };

          for (const name of Object.keys(tasks)) {
            const task = tasks[name];
            prereqsStateParams.tasks[name] = {
              fullName: task.fullName,
              order: task.order,
              status: PrereqStatus.Pending,
              progress: 0,
              eta: 0,
              bps: 0,
            };
          }

          prereqsModal = modalWidgets.prereqsState.make({
            window: "root",
            title: ["grid.item.installing"],
//.........这里部分代码省略.........
开发者ID:HorrerGames,项目名称:itch,代码行数:101,代码来源:perform-launch.ts


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