Home > @uniformdev/canvas > parseVariableExpression

parseVariableExpression() function

Parses an expression that may contain Uniform variables and invokes a callback for each text or variable token found

Signature:

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

serialized

</td><td>

string

</td><td>

</td></tr> <tr><td>

onToken

</td><td>

(token: string, type: 'text' | 'variable') => void | false

</td><td>

(Optional)

</td></tr> </tbody></table> Returns:

number

the number of tokens found in the string (variable or text)