ViewTokenList
Token list. Allows handling (adding, removing, retrieving) a set of tokens (for example class names).
Properties
-
isEmpty : boolean
readonlymodule:engine/view/tokenlist~ViewTokenList#isEmpty
Returns true if token list has no tokens set.
-
size : number
readonlymodule:engine/view/tokenlist~ViewTokenList#size
Number of tokens.
-
_set : Set<string>
privatemodule:engine/view/tokenlist~ViewTokenList#_set
The set of tokens.
Methods
-
clear() → void
module:engine/view/tokenlist~ViewTokenList#clear
-
has( name ) → boolean
module:engine/view/tokenlist~ViewTokenList#has
Checks if a given token is set.
Parameters
name : string
Returns
boolean
-
isSimilar( other ) → boolean
module:engine/view/tokenlist~ViewTokenList#isSimilar
Returns
true
if both attributes have the same tokens.Parameters
other : ViewTokenList
Returns
boolean
-
keys() → Array<string>
module:engine/view/tokenlist~ViewTokenList#keys
-
remove( tokens ) → void
module:engine/view/tokenlist~ViewTokenList#remove
-
set( tokens ) → void
module:engine/view/tokenlist~ViewTokenList#set
Sets a given token without affecting other tokens.
Parameters
tokens : ArrayOrItem<string>
Returns
void
-
setTo( value ) → this
module:engine/view/tokenlist~ViewTokenList#setTo
Resets the value to the given one.
Parameters
value : string
Returns
this
-
toString() → string
module:engine/view/tokenlist~ViewTokenList#toString
-
_canMergeFrom() → boolean
internalmodule:engine/view/tokenlist~ViewTokenList#_canMergeFrom
Used by
_canMergeAttributesFrom
to verify if the given attribute can be merged without conflicts into the attribute.This method is indirectly used by the
ViewDowncastWriter
while downcasting anViewAttributeElement
to merge it with otherAttributeElement
.Returns
boolean
-
_clone() → this
internalmodule:engine/view/tokenlist~ViewTokenList#_clone
-
_getConsumables( [ name ] ) → Array<string>
internalmodule:engine/view/tokenlist~ViewTokenList#_getConsumables
Returns a list of consumables for the attribute.
Could be filtered by the given token name.
Parameters
[ name ] : string
Returns
Array<string>
-
_getTokensMatch( tokenPattern ) → undefined | Array<string>
internalmodule:engine/view/tokenlist~ViewTokenList#_getTokensMatch
Used by the Matcher to collect matching attribute tokens.
Parameters
tokenPattern : string | true | RegExp
The matched token name pattern.
Returns
undefined | Array<string>
An array of matching tokens.
-
_isMatching( other ) → boolean
internalmodule:engine/view/tokenlist~ViewTokenList#_isMatching
Used by
_canSubtractAttributesOf
to verify if the given attribute can be fully subtracted from the attribute.This method is indirectly used by the
ViewDowncastWriter
while down-casting anViewAttributeElement
to unwrap the ViewAttributeElement.Parameters
other : ViewTokenList
Returns
boolean
-
_mergeFrom( other ) → void
internalmodule:engine/view/tokenlist~ViewTokenList#_mergeFrom
Used by
_mergeAttributesFrom
to merge a given attribute into the attribute.This method is indirectly used by the
ViewDowncastWriter
while down-casting anViewAttributeElement
to merge it with other ViewAttributeElement.Parameters
other : ViewTokenList
Returns
void