• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript actions.actions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: async

      onError: async (e, log) => {
        const response = await promisedModal(
          store,
          modals.showError.make({
            wind: "root",
            title: ["prompt.uninstall_error.title"],
            message: ["prompt.uninstall_error.message"],
            buttons: [
              {
                label: ["prompt.action.ok"],
                action: actions.modalResponse({}),
              },
              "cancel",
            ],
            widgetParams: { rawError: e, log },
          })
        );

        if (!response) {
          // modal was closed
          return;
        }

        logger.info(`Should remove entry anyway, performing hard uninstall`);
        try {
          await mcall(messages.UninstallPerform, { caveId, hard: true });
          store.dispatch(actions.uninstallEnded({}));
        } catch (e) {
          logger.error(`Well, even hard uninstall didn't work: ${e.stack}`);
        }
      },
开发者ID:itchio,项目名称:itch,代码行数:31,代码来源:queue-cave-uninstall.ts


示例2: async

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

    const { cave } = await mcall(messages.FetchCave, { caveId });
    const { game } = cave;

    // FIXME: i18n - plus, that's generally bad
    const title = game ? game.title : "this";

    store.dispatch(
      actions.openModal(
        modals.naked.make({
          wind: "root",
          title: "",
          message: ["prompt.uninstall.message", { title }],
          buttons: [
            {
              label: ["prompt.uninstall.reinstall"],
              id: "modal-reinstall",
              action: actions.queueCaveReinstall({ caveId }),
              icon: "repeat",
            },
            {
              label: ["prompt.uninstall.uninstall"],
              id: "modal-uninstall",
              action: actions.queueCaveUninstall({ caveId }),
              icon: "uninstall",
            },
            "cancel",
          ],
          widgetParams: null,
        })
      )
    );
  });
开发者ID:itchio,项目名称:itch,代码行数:35,代码来源:request-cave-uninstall.ts


示例3: async

        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"],
            message: "",
            widgetParams: prereqsStateParams,
            buttons: [
              {
                id: "modal-cancel",
                label: ["prompt.action.cancel"],
                action: actions.abortTask({ id: ctx.getTaskId() }),
                className: "secondary",
              },
            ],
            unclosable: true,
          });
          store.dispatch(actions.openModal(prereqsModal));
        });
开发者ID:HorrerGames,项目名称:itch,代码行数:35,代码来源:perform-launch.ts


示例4: 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


示例5: async

  watcher.on(actions.useSavedLogin, async (store, action) => {
    const profileId = action.payload.profile.id;
    logger.info(`Attempting saved login for profile ${profileId}`);
    store.dispatch(actions.attemptLogin({}));

    try {
      const { profile } = await withTimeout(
        "Saved login",
        LOGIN_TIMEOUT,
        mcall(
          messages.ProfileUseSavedLogin,
          {
            profileId,
          },
          convo => {
            hookLogging(convo, logger);
          }
        )
      );
      logger.info(`Saved login succeeded!`);
      await loginSucceeded(store, profile);
    } catch (e) {
      // TODO: handle offline login
      const originalProfile = action.payload.profile;
      store.dispatch(
        actions.loginFailed({
          username: originalProfile.user.username,
          error: e,
        })
      );
    }
  });
开发者ID:itchio,项目名称:itch,代码行数:32,代码来源:login.ts


示例6: formatOperation

  const itemForOperation = (operation: IOperation): IMenuItem => {
    const localizedLabel = formatOperation(operation);
    if (operation.name === "launch") {
      return {
        localizedLabel,
        submenu: [
          {
            localizedLabel: ["prompt.action.force_close"],
            action: actions.forceCloseGameRequest({ game }),
          },
        ],
      };
    } else {
      const item: IMenuItem = {
        localizedLabel,
        enabled: false,
      };

      if (operation.type === OperationType.Download && operation.id) {
        item.submenu = [
          {
            localizedLabel: ["grid.item.discard_download"],
            action: actions.discardDownload({ id: operation.id }),
          },
        ];
      }
      return item;
    }
  };
开发者ID:HorrerGames,项目名称:itch,代码行数:29,代码来源:build-template.ts


示例7: async

 watcher.on(actions.silentlyScanInstallLocations, async (store, action) => {
   try {
     logger.info(`Scanning install locations for items...`);
     await mcall(
       messages.InstallLocationsScan,
       {
         legacyMarketPath: legacyMarketPath(),
       },
       convo => {
         hookLogging(convo, logger);
         convo.on(messages.Progress, async ({ progress }) => {
           store.dispatch(actions.locationScanProgress({ progress }));
         });
         convo.on(messages.InstallLocationsScanYield, async ({ game }) => {
           logger.info(`Found ${game.title} - ${game.url}`);
         });
         convo.on(
           messages.InstallLocationsScanConfirmImport,
           async ({ numItems }) => {
             logger.info(`In total, found ${numItems} items.`);
             return { confirm: true };
           }
         );
       }
     );
     logger.info(`Scan complete.`);
     store.dispatch(actions.newItemsImported({}));
   } finally {
     store.dispatch(actions.locationScanDone({}));
   }
 });
开发者ID:itchio,项目名称:itch,代码行数:31,代码来源:silent-location-scan.ts


示例8: onMessage

 private onMessage(logger: Logger, msg: ISM) {
   if (msg.type === "no-update-available") {
     this.stage("idle");
   } else if (msg.type === "installing-update") {
     this.stage("download");
   } else if (msg.type === "update-failed") {
     const pp = msg.payload as ISM_UpdateFailed;
     logger.error(`Self-update failed: ${pp.message}`);
   } else if (msg.type === "update-ready") {
     const pp = msg.payload as ISM_UpdateReady;
     logger.info(`Version ${pp.version} is ready to be used.`);
     this.store.dispatch(
       actions.packageNeedRestart({
         name: this.name,
         availableVersion: pp.version,
       })
     );
   } else if (msg.type === "progress") {
     const pp = msg.payload as ISM_Progress;
     this.store.dispatch(
       actions.packageProgress({
         name: this.name,
         progressInfo: pp,
       })
     );
   } else if (msg.type === "log") {
     const pp = msg.payload as ISM_Log;
     logger.info(`> ${pp.message}`);
   }
 }
开发者ID:itchio,项目名称:itch,代码行数:30,代码来源:self-package.ts


示例9: async

  watcher.on(actions.relaunchRequest, async (store, action) => {
    const rs = store.getState();
    const pkg = rs.broth.packages[rs.system.appName];
    if (pkg.stage !== "need-restart") {
      return;
    }
    const version = pkg.availableVersion;
    const restart = t(rs.i18n, ["prompt.self_update_ready.action.restart"]);

    store.dispatch(
      actions.openModal(
        modals.naked.make({
          wind: "root",
          title: ["prompt.self_update.title", { version }],
          message: ["prompt.self_update_ready.message", { restart }],
          buttons: [
            {
              label: ["prompt.self_update_ready.action.restart"],
              action: actions.relaunch({}),
            },
            {
              label: ["prompt.self_update_ready.action.snooze"],
              action: actions.closeModal({ wind: "root" }),
            },
          ],
          widgetParams: null,
        })
      )
    );
  });
开发者ID:itchio,项目名称:itch,代码行数:30,代码来源:self-update.ts


示例10: dispatchUpdateNotification

function dispatchUpdateNotification(
  store: Store,
  cave: Cave,
  result: CheckUpdateResult
) {
  if (!result) {
    return;
  }

  if (!isEmpty(result.warnings)) {
    store.dispatch(
      actions.statusMessage({
        message: [
          "status.game_update.check_failed",
          { err: result.warnings[0] },
        ],
      })
    );
    return;
  }

  if (isEmpty(result.updates)) {
    store.dispatch(
      actions.statusMessage({
        message: ["status.game_update.not_found", { title: cave.game.title }],
      })
    );
  } else {
    store.dispatch(
      actions.statusMessage({
        message: ["status.game_update.found", { title: cave.game.title }],
      })
    );
  }
}
开发者ID:itchio,项目名称:itch,代码行数:35,代码来源:updater.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript index.actions类代码示例发布时间:2022-05-25
下一篇:
TypeScript common-app.UploaderActions类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap