Search
Loading...
Skip to content

Class: VariableAPI

Manage text variables within design templates.

Text variables enable dynamic content replacement in design templates. Variables are stored as key-value pairs and can be referenced in text blocks for automated content updates.

// Configure a text block that displays 'Hello, World'
const block = cesdk.engine.block.create('text');
cesdk.engine.block.setText(block, 'Hello, {{name}}!');
cesdk.engine.variable.setString('name', 'World');

Variable Management#

Create, update, retrieve, and remove text variables from the engine.

findAll()#


Get all text variable names currently stored in the engine.

Returns#

string[]

List of variable names.

Signature#

findAll(): string[]

setString()#


Set a text variable’s value.

Creates a new variable if the key doesn’t exist, or updates an existing one.

Parameters#

ParameterTypeDescription
keystringThe variable’s key.
valuestringThe text value to assign to the variable.

Returns#

void

Signature#

setString(key: string, value: string): void

getString()#


Get a text variable’s value.

Parameters#

ParameterTypeDescription
keystringThe variable’s key.

Returns#

string

The text value of the variable.

Signature#

getString(key: string): string

remove()#


Remove a text variable from the engine.

Parameters#

ParameterTypeDescription
keystringThe variable’s key to remove.

Returns#

void

Signature#

remove(key: string): void