UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

129 lines (72 loc) 2.46 kB
# Interface: IVariableManager Provides methods and properties for managing configuration variables. ## Hierarchy * **IVariableManager** ## Implemented by * [VariableManager](../classes/variablemanager.md) ## Index ### Properties * [editor](ivariablemanager.md#editor) * [variables](ivariablemanager.md#variables) ### Methods * [append](ivariablemanager.md#append) * [appendExpression](ivariablemanager.md#appendexpression) * [calculate](ivariablemanager.md#calculate) * [calculateAll](ivariablemanager.md#calculateall) * [init](ivariablemanager.md#init) ## Properties ### editor**editor**: *[AuWizard](../classes/auwizard.md)* A reference to an editor's instance. ___ ### variables • **variables**: *any* An object containing variables for the editor config. ## Methods ### append ▸ **append**(`name`: string, `value`: any, `updateScope?`: boolean): *void* Appends a new variable to the `vars` object or updates an existing variable. **Parameters:** Name | Type | Description | ------ | ------ | ------ | `name` | string | The name of the variable. | `value` | any | The value of the variable. | `updateScope?` | boolean | If `true`, runs scope recompilation so that widgets get updated parameters. | **Returns:** *void* ___ ### appendExpression**appendExpression**(`name`: string, `value`: string): *any* Appends a new expression to the editor's variables or updates an existing variable. **Parameters:** Name | Type | Description | ------ | ------ | ------ | `name` | string | The name of the variable. | `value` | string | The expression of the variable. | **Returns:** *any* The calculated value of the expression. ___ ### calculate ▸ **calculate**(`name`: string): *any* Gets a variable by its name and calculates its value. **Parameters:** Name | Type | Description | ------ | ------ | ------ | `name` | string | The variable name. | **Returns:** *any* The calculated value of the variable. ___ ### calculateAll**calculateAll**(): *object* Calculates all the editor's variables. **Returns:** *object* A dictionary of calculated variable values. * \[ **name**: *string*\]: any ___ ### init ▸ **init**(`initialVars`: any): *void* Initializes the variable manager with the defined editor's variables. **Parameters:** Name | Type | Description | ------ | ------ | ------ | `initialVars` | any | The `vars` object defined in the editor's config. | **Returns:** *void*