pixso.variables
These are all defined on pixso.variables.
getVariableByIdAsync
getVariableByIdAsync(id: string): Promise<VariableNode | null>Finds a variable by ID. If not found or the provided ID is invalid, returns a promise containing null.
getVariableCollectionByIdAsync
getVariableCollectionByIdAsync(id: string): Promise<VariableCollection | null>Finds a variable collection by ID. If not found or the provided ID is invalid, returns a promise containing null.
getLocalVariablesAsync
getLocalVariablesAsync(type?: VariableResolvedDataType): Promise<Variable[]>Returns all local variables in the current file, optionally filtering by resolved type.
getLocalVariableCollectionsAsync
getLocalVariableCollectionsAsync(): Promise<VariableCollection[]>Returns all local variable collections in the current file.
createVariable
createVariable(name: string, collection: VariableCollection, resolvedType: VariableResolvedDataType): VariableCreates a variable with a given name and resolved type inside a collection.
createVariableCollection
createVariableCollection(name: string): VariableCollectionCreates a new variable collection with the given name.
createVariableAlias
createVariableAlias(variable: Variable): VariableAliasHelper function to create a variable alias.
createVariableAliasByIdAsync
createVariableAliasByIdAsync(variableId: string): Promise<VariableAlias>Helper function to create a variable alias.
setBoundVariableForPaint
setBoundVariableForPaint(paint: SolidPaint, field: VariableBindablePaintField, variable: Variable | null): SolidPaintHelper function to bind a variable to a SolidPaint. If null is provided as the variable, the given field will be unbound from any variables.
setBoundVariableForEffect
setBoundVariableForEffect(effect: Effect, field: VariableBindableEffectField, variable: Variable | null): EffectHelper function to bind a variable to an Effect.If null is provided as the variable, the given field will be unbound from any variables.
setBoundVariableForLayoutGrid
setBoundVariableForLayoutGrid(layoutGrid: LayoutGrid, field: VariableBindableLayoutGridField, variable: Variable | null): LayoutGridHelper function to bind a variable to a LayoutGrid.If null is provided as the variable, the given field will be unbound from any variables.
importVariableByKeyAsync
importVariableByKeyAsync(key: string): Promise<Variable>Loads a variable from the team library. Promise is rejected if there is no published variable with that key or if the request fails.