本文整理汇总了TypeScript中@stimulus/multimap.Multimap类的典型用法代码示例。如果您正苦于以下问题:TypeScript Multimap类的具体用法?TypeScript Multimap怎么用?TypeScript Multimap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Multimap类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: scopeDisconnected
/** @private */
scopeDisconnected(scope: Scope) {
this.scopesByIdentifier.delete(scope.identifier, scope)
const module = this.modulesByIdentifier.get(scope.identifier)
if (module) {
module.disconnectContextForScope(scope)
}
}
示例2: refreshTokensForElement
private refreshTokensForElement(element: Element): [Token[], Token[]] {
const previousTokens = this.tokensByElement.getValuesForKey(element)
const currentTokens = this.readTokensForElement(element)
const firstDifferingIndex = zip(previousTokens, currentTokens)
.findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken))
if (firstDifferingIndex == -1) {
return [[], []]
} else {
return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)]
}
}
示例3: tokenUnmatched
private tokenUnmatched(token: Token) {
this.delegate.tokenUnmatched(token)
this.tokensByElement.delete(token.element, token)
}
示例4: tokenMatched
private tokenMatched(token: Token) {
this.delegate.tokenMatched(token)
this.tokensByElement.add(token.element, token)
}
示例5: elementUnmatchedAttribute
elementUnmatchedAttribute(element: Element) {
this.tokensUnmatched(this.tokensByElement.getValuesForKey(element))
}
示例6: connectModule
private connectModule(module: Module) {
this.modulesByIdentifier.set(module.identifier, module)
const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier)
scopes.forEach(scope => module.connectContextForScope(scope))
}