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


TypeScript actions.ownedKeysFetched方法代码示例

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


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

示例1: doAsync

      doAsync(async () => {
        try {
          const dkIdString = details.responseHeaders["X-Itch-Download-Key-Id"];
          const pIdString =
            details.responseHeaders["X-Itch-Download-Key-Owner-Id"];
          if (dkIdString && pIdString) {
            const downloadKeyId = parseInt(dkIdString, 10);
            const profileId = parseInt(pIdString, 10);
            const { downloadKeys } = store.getState().commons;

            logger.info(
              `Visiting download key page, has key ${downloadKeyId} (owner ${profileId})`
            );

            if (!downloadKeys[downloadKeyId]) {
              logger.info(`That's a new key, fetching...`);
              await mcall(messages.FetchDownloadKey, {
                downloadKeyId,
                profileId,
              });
              store.dispatch(actions.ownedKeysFetched({}));
            }
          }
        } catch (e) {
          logger.warn(`While sniffing headers: ${e.stack}`);
        }
      });
开发者ID:itchio,项目名称:itch,代码行数:27,代码来源:register-itch-protocol.ts

示例2: loginSucceeded

async function loginSucceeded(store: Store, profile: Profile) {
  logger.info(`Login succeeded, setting up session`);
  try {
    const userId = profile.id;
    const partition = partitionForUser(String(userId));
    const customSession = session.fromPartition(partition, { cache: true });
    logger.info(`Registering itch protocol for session ${partition}`);
    registerItchProtocol(store, customSession);
  } catch (e) {
    logger.warn(`Could not register itch protocol for session: ${e.stack}`);
  }

  try {
    logger.info(`Restoring tabs...`);
    await restoreTabs(store, profile);
  } catch (e) {
    logger.warn(`Could not restore tabs: ${e.stack}`);
  }

  logger.info(`Dispatching login succeeded`);
  store.dispatch(actions.loginSucceeded({ profile }));

  try {
    logger.info(`Fetching owned keys...`);
    let t1 = Date.now();
    await mcall(
      messages.FetchProfileOwnedKeys,
      {
        profileId: profile.id,
        fresh: true,
        limit: 1,
      },
      convo => {
        hookLogging(convo, logger);
      }
    );
    let t2 = Date.now();
    logger.info(`Fetched owned keys in ${elapsed(t1, t2)}`);
    store.dispatch(actions.ownedKeysFetched({}));
  } catch (e) {
    logger.warn(`In initial owned keys fetch: ${e.stack}`);
  }
}
开发者ID:itchio,项目名称:itch,代码行数:43,代码来源:login.ts


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