當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。