本文整理汇总了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();
}