本文整理匯總了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);
}
};
示例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()
})
);
});
}
示例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();
}