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

TypeScript map-like.MapLike类代码示例

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

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



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

示例1: withoutDuplicated

 /**
  * filter duplicated rules and rulesConfig and return new RuleCreatorSet.
  * @return {RuleCreatorSet}
  */
 withoutDuplicated(): RuleCreatorSet {
     const newRawRules: {
         [index: string]: any;
     } = {};
     const newRawRulesConfig: {
         [index: string]: any;
     } = {};
     // for index
     const addedRuleMap = new MapLike<string, any[]>();
     // if already contain same ruleModule and ruleConfig value
     // Fill following condition, remove it
     // 1. same ruleModule
     // 2. same ruleConfig
     this.ruleNames.forEach(ruleName => {
         const rule = this.rules[ruleName];
         const ruleConfig = this.rulesConfig[ruleName];
         const savedConfigList = addedRuleMap.get(rule) || [];
         // same ruleCreator and ruleConfig
         const hasSameConfig = savedConfigList.some(savedConfig => {
             return deepEqual(savedConfig, ruleConfig, { strict: true });
         });
         if (hasSameConfig) {
             return;
         }
         newRawRules[ruleName] = rule;
         newRawRulesConfig[ruleName] = ruleConfig;
         // saved
         savedConfigList.push(ruleConfig);
         addedRuleMap.set(rule, savedConfigList);
     });
     addedRuleMap.clear();
     return new RuleCreatorSet(newRawRules, newRawRulesConfig);
 }
开发者ID:,项目名称:,代码行数:37,代码来源:


示例2: it

 it("The user can know that the UseCase is just finished by isUseCaseFinished", () => {
     const dispatcher = new Dispatcher();
     const context = new Context({
         dispatcher,
         store: createStore({ name: "test" })
     });
     const useCase = new DispatchUseCase();
     let callCount = 0;
     const finishedCallback = () => {
         callCount++;
     };
     const calledMap = new MapLike();
     dispatcher.onDispatch((payload, meta) => {
         if (payload instanceof DidExecutedPayload && meta.useCase && meta.isUseCaseFinished) {
             calledMap.set(meta.useCase.id, true);
             finishedCallback();
         } else if (payload instanceof CompletedPayload && meta.useCase && meta.isUseCaseFinished) {
             if (calledMap.has(meta.useCase.id)) {
                 return void calledMap.delete(meta.useCase.id);
             }
             finishedCallback();
         }
         return;
     });
     return context
         .useCase(useCase)
         .execute({ type: "test" })
         .then(() => {
             assert.equal(callCount, 1);
         });
 });
开发者ID:almin,项目名称:almin,代码行数:31,代码来源:DispatcherPayloadMeta-test.ts


示例3: LogChunk

 const onCompleteUseCase = (payload: CompletedPayload, meta: DispatcherPayloadMeta) => {
     const useCase = meta.useCase;
     if (!useCase) {
         return;
     }
     const resultValue = payload.value;
     const logGroup = this.useCaseLogGroupMap.get(useCase);
     if (!logGroup) {
         console.warn("Warning(almin-logger): logGroup is not found. please report as issue.", payload, meta);
         return;
     }
     logGroup.addChunk(
         new LogChunk({
             useCase,
             payload,
             log: [`${useCase.name} is completed:`, resultValue],
             timeStamp: meta.timeStamp
         })
     );
     const transactionLogGroup = getTransactionLogGroup(meta);
     if (!transactionLogGroup) {
         outputLogging(logGroup);
     }
     this.useCaseLogGroupMap.delete(useCase);
 };
开发者ID:almin,项目名称:almin,代码行数:25,代码来源:AsyncLogger.ts


示例4: finishedCallback

 dispatcher.onDispatch((payload, meta) => {
     if (payload instanceof DidExecutedPayload && meta.useCase && meta.isUseCaseFinished) {
         calledMap.set(meta.useCase.id, true);
         finishedCallback();
     } else if (payload instanceof CompletedPayload && meta.useCase && meta.isUseCaseFinished) {
         if (calledMap.has(meta.useCase.id)) {
             return void calledMap.delete(meta.useCase.id);
         }
         finishedCallback();
     }
     return;
 });
开发者ID:almin,项目名称:almin,代码行数:12,代码来源:DispatcherPayloadMeta-test.ts


示例5: close

 /**
  * End transaction of the useCaseExecutor/UseCase
  */
 close(useCaseExecutor: UseCaseExecutor<any>) {
     const unsubscribe = this.unsubscribeMap.get(useCaseExecutor);
     if (typeof unsubscribe !== "function") {
         console.error(
             "Warning(UnitOfWork): This UseCaseExecutor is not opened or already closed.",
             useCaseExecutor
         );
         return;
     }
     unsubscribe();
     this.unsubscribeMap.delete(useCaseExecutor);
 }
开发者ID:almin,项目名称:almin,代码行数:15,代码来源:UseCaseUnitOfWork.ts


示例6: deepEqual

 this.ruleNames.forEach(ruleName => {
     const rule = this.rules[ruleName];
     const ruleConfig = this.rulesConfig[ruleName];
     const savedConfigList = addedRuleMap.get(rule) || [];
     // same ruleCreator and ruleConfig
     const hasSameConfig = savedConfigList.some(savedConfig => {
         return deepEqual(savedConfig, ruleConfig, { strict: true });
     });
     if (hasSameConfig) {
         return;
     }
     newRawRules[ruleName] = rule;
     newRawRulesConfig[ruleName] = ruleConfig;
     // saved
     savedConfigList.push(ruleConfig);
     addedRuleMap.set(rule, savedConfigList);
 });
开发者ID:,项目名称:,代码行数:17,代码来源:


示例7:

 const getTransactionLogGroup = (meta: DispatcherPayloadMeta) => {
     // if it is transaction, add this logGroup as child of transaction
     const transactionId = meta.transaction && meta.transaction.id;
     if (transactionId) {
         return this._transactionMap.get(transactionId);
     }
     return;
 };
开发者ID:almin,项目名称:almin,代码行数:8,代码来源:AsyncLogger.ts


示例8: LogGroup

 const onBeginTransaction = (_payload: TransactionBeganPayload, meta: DispatcherPayloadMeta) => {
     if (!meta.transaction) {
         console.warn("meta.transaction is missing");
         return;
     }
     const logGroup = new LogGroup({ title: meta.transaction.name, isTransaction: true });
     this._transactionMap.set(meta.transaction.id, logGroup);
     // the logGroup is root
     this.currentLogBuffer.push(logGroup);
 };
开发者ID:almin,项目名称:almin,代码行数:10,代码来源:AsyncLogger.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript mapbox-gl.Point类代码示例发布时间:2022-05-25
下一篇:
TypeScript mantra-core.IKomposerData类代码示例发布时间: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