mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
feat(sdk): getVariableValue({ base: true }) reads pre-override declared defaults
This commit is contained in:
@@ -117,7 +117,7 @@ comp.setVariableValue("heroImage", { url: "/assets/hero.jpg", fit: "cover" });
|
||||
### `getVariableValue`
|
||||
|
||||
```typescript
|
||||
getVariableValue(id: string): string | number | boolean | FontValue | ImageValue | undefined
|
||||
getVariableValue(id: string, opts?: { base?: boolean }): string | number | boolean | FontValue | ImageValue | undefined
|
||||
```
|
||||
|
||||
Return a declared variable's current `default` value, or `undefined` if the id is undeclared or has no value set.
|
||||
@@ -126,6 +126,12 @@ Return a declared variable's current `default` value, or `undefined` if the id i
|
||||
const color = comp.getVariableValue("brandColor"); // "#6C5CE7"
|
||||
```
|
||||
|
||||
Pass `{ base: true }` to read the default **as authored at open** — before the
|
||||
T3 override-set or any `setVariableValue` folded into the declaration. This is
|
||||
the value to restore when a host replays an undo that removes a `var.<id>`
|
||||
override. For a variable declared mid-session, `{ base: true }` returns its
|
||||
live default (its declaration is its base).
|
||||
|
||||
### `listVariables`
|
||||
|
||||
```typescript
|
||||
@@ -753,4 +759,3 @@ comp.dispose();
|
||||
Template-driven products with host-owned history.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user