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