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


TypeScript MapLike.keys方法代码示例

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


在下文中一共展示了MapLike.keys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: addLog

 /**
  * add log to logger
  * @param {*} log
  */
 addLog(log: any) {
     const useCases = this.useCaseLogGroupMap.keys();
     useCases.forEach(useCase => {
         const logGroup = this.useCaseLogGroupMap.get(useCase);
         if (!logGroup) {
             return;
         }
         logGroup.addChunk(
             new LogChunk({
                 log,
                 timeStamp: Date.now()
             })
         );
     });
 }
开发者ID:almin,项目名称:almin,代码行数:19,代码来源:AsyncLogger.ts

示例3: release

    /**
     * Release this Unit of Work.
     * After released, can't commit this Unit of Work.
     *
     * Please call `exit` or `commit at once before releasing.
     */
    release() {
        if (!this.options.autoCommit && !this.doesReflectActionAtLeastOne) {
            if (process.env.NODE_ENV !== "production") {
                console.error(`Warning(UnitOfWork): Transaction(${
                    this.name
                }) should be commit() or exit() at least one. 
If you not want to commit, Please call \`transactionContext.exit()\` at end of transaction.
`);
            }
            this.exit();
        }
        this.unsubscribeMap.keys().forEach(useCaseExecutor => {
            this.close(useCaseExecutor);
        });
        this.unitOfWork.release();
    }
开发者ID:almin,项目名称:almin,代码行数:22,代码来源:UseCaseUnitOfWork.ts


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