本文整理汇总了TypeScript中map-like.MapLike.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MapLike.set方法的具体用法?TypeScript MapLike.set怎么用?TypeScript MapLike.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map-like.MapLike
的用法示例。
在下文中一共展示了MapLike.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: LogGroup
const onBeginTransaction = (_payload: TransactionBeganPayload, meta: DispatcherPayloadMeta) => {
if (!meta.transaction) {
console.warn("meta.transaction is missing");
return;
}
const logGroup = new LogGroup({ title: meta.transaction.name, isTransaction: true });
this._transactionMap.set(meta.transaction.id, logGroup);
// the logGroup is root
this.currentLogBuffer.push(logGroup);
};
示例2: finishedCallback
dispatcher.onDispatch((payload, meta) => {
if (payload instanceof DidExecutedPayload && meta.useCase && meta.isUseCaseFinished) {
calledMap.set(meta.useCase.id, true);
finishedCallback();
} else if (payload instanceof CompletedPayload && meta.useCase && meta.isUseCaseFinished) {
if (calledMap.has(meta.useCase.id)) {
return void calledMap.delete(meta.useCase.id);
}
finishedCallback();
}
return;
});
示例3: 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);
});
示例4: open
/**
* Begin transaction of the useCaseExecutor/UseCase
*/
open(useCaseExecutor: UseCaseExecutor<any>) {
const onDispatchOnUnitOfWork = (payload: Payload, meta: DispatcherPayloadMeta) => {
// If unit of work is working as transaction, overwrite meta.transaction
if (this.isTransactionWorking) {
meta.transaction = {
id: this.id,
name: this.name
};
}
// Notes: It is specific order for updating store logging
// 1. Commit
this.unitOfWork.addCommitment({
payload,
meta,
debugId: this.id
});
// 2. Dispatch to Dispatcher
this.dispatcher.dispatch(payload, meta);
};
const unsubscribe = useCaseExecutor.onDispatch(onDispatchOnUnitOfWork);
this.unsubscribeMap.set(useCaseExecutor, unsubscribe);
}