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