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


TypeScript MapLike.get方法代码示例

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


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

示例1: LogChunk

 const onWillNptExecuteEachUseCase = (payload: WillNotExecutedPayload, meta: DispatcherPayloadMeta) => {
     const useCase = meta.useCase;
     if (!useCase) {
         return;
     }
     const parentUseCase =
         meta.parentUseCase !== useCase && meta.parentUseCase instanceof UseCase ? meta.parentUseCase : null;
     const parentSuffix = parentUseCase ? ` <- ${parentUseCase.name}` : "";
     const useCaseName = useCase ? useCase.name : "<no-name>";
     const title = `${useCaseName}${parentSuffix}`;
     const args = payload.args.length && payload.args.length > 0 ? payload.args : [undefined];
     const log = [`${useCaseName} not execute:`].concat(args);
     const useCases = this.useCaseLogGroupMap.keys();
     const existWorkingUseCase = useCases.length !== 0;
     if (existWorkingUseCase) {
         const logGroup = this.useCaseLogGroupMap.get(useCase);
         if (!logGroup) {
             return;
         }
         logGroup.addChunk(
             new LogChunk({
                 log: [log],
                 payload,
                 useCase: meta.useCase,
                 timeStamp: meta.timeStamp
             })
         );
     } else {
         // immediately dump log
         const logGroup = new LogGroup({ title, useCaseName: useCaseName });
         this.printLogger.printLogGroup(logGroup);
     }
 };
开发者ID:almin,项目名称:almin,代码行数:33,代码来源:AsyncLogger.ts

示例2:

 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

示例3: tryGetState

 const onChangeStore = (payload: StoreChangedPayload, meta: DispatcherPayloadMeta) => {
     const store = payload.store as Store;
     const storeName = store.name ? store.name : "no-name";
     // one, or more stores
     const useCases = this.useCaseLogGroupMap.keys();
     const workingUseCaseNames = useCases.map(useCase => {
         return useCase.name;
     });
     const existWorkingUseCase = workingUseCaseNames.length !== 0;
     if (existWorkingUseCase) {
         const state = tryGetState(store);
         if (meta.useCase) {
             const logGroup = this.useCaseLogGroupMap.get(meta.useCase);
             if (!logGroup) {
                 return;
             }
             logGroup.addChunk(
                 new LogChunk({
                     log: [`\u{1F4BE} Store:${storeName}`, state !== null ? state : store],
                     payload,
                     useCase: meta.useCase,
                     timeStamp: meta.timeStamp
                 })
             );
         } else {
             // add log to all UseCase
             this.addLog([`\u{1F4BE} Store:${storeName}`, state !== null ? state : store]);
             if (workingUseCaseNames.length >= 2) {
                 this.addLog(`\u{2139}\u{FE0F} Currently executing UseCases: ${workingUseCaseNames.join(", ")}`);
             }
         }
     } else {
         // Async update of StoreGroup
         const transactionLogGroup = getTransactionLogGroup(meta);
         if (transactionLogGroup) {
             const state = tryGetState(store);
             transactionLogGroup.addChunk(
                 new LogChunk({
                     log: [`\u{1F4BE} Store:${storeName}`, state !== null ? state : store],
                     timeStamp: meta.timeStamp
                 })
             );
         } else {
             // If isolated store update, immediate dump this
             const storeLogGroup = new LogGroup({
                 title: `Store(${storeName}) is changed`
             });
             const state = tryGetState(store);
             storeLogGroup.addChunk(
                 new LogChunk({
                     log: [`\u{1F4BE} Store:${storeName}`, state !== null ? state : store],
                     timeStamp: meta.timeStamp
                 })
             );
             this.printLogger.printLogGroup(storeLogGroup);
         }
     }
 };
开发者ID:almin,项目名称:almin,代码行数:58,代码来源:AsyncLogger.ts

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

示例5: 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,代码来源:


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