Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] [EDT-1086] Improved get/set for Actions #331

Merged
merged 6 commits into from
Sep 5, 2023

Conversation

Matthiee
Copy link
Member

@Matthiee Matthiee commented Aug 24, 2023

This PR improves Action Typings with the engine changes.

Get properties

The getter properties on objects will now reflect the actual value vs snapshot value before.

Example:

const frame = studio.frames.byName("bottle");
console.log(frame.width); // 100
frame.setWidth(200);
console.log(frame.width); // 200

Set methods

Setter methods have been added on studio objects as a shorthand for studio.[controller].[setMethod].

See PR for the full list of setter methods that have been added.

Example;

const frame = studio.frames.byName("bottle");
frame.setWidth(200); // shorthand for studio.frames.setWidth("bottle", 200);

const layout = studio.layouts.byName("Skyscraper");
layout.select(); // shorthand for studio.layouts.select("Skyscraper");

const variable = studio.variables.byName("list");
variable.setValue("Orange"); // shorthand for studio.variables.setValue("list", "Orange");

Improved argument types

In order to use actions more easily in advanced scenarios, the argument types for certain methods have been extended.

Example:

// Inside a List variable value changed trigger
const layoutToSelect = triggers.changedVariable.value; // Returns the selected item from the List variable

// The following will now work.
// Previously: Argument of type 'VariableValue' is not assignable to parameter of type 'string'.
studio.layouts.select(layoutToSelect); 

Example named objects:

studio.variables.setValue(studio.variables.byName("myVariable"), "some value"); // .name no longer required

const imageVariable = studio.variables.byName("myImageVariable");
const imageFrame = studio.variables.byName("myImageFrame");

imageFrame.assignVariable(imageVariable); // .name no longer required
studio.frames.assignVariable(imageVariable, imageFrame); // .name no longer required

Related tickets

@Matthiee Matthiee self-assigned this Aug 24, 2023
@github-actions
Copy link
Contributor

Coverage report can be checked at https://chili-dev.azureedge.net/sdk/coverage/331/coverage.html

@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2023

Unit Test Results

    1 files    30 suites   26s ⏱️
270 tests 270 ✔️ 0 💤 0
271 runs  271 ✔️ 0 💤 0

Results for commit a5f027b.

♻️ This comment has been updated with latest results.

types/Actions.d.ts Outdated Show resolved Hide resolved
types/Actions.d.ts Outdated Show resolved Hide resolved
@Matthiee Matthiee marked this pull request as ready for review August 24, 2023 12:27
@Dvergar Dvergar self-requested a review August 24, 2023 12:32
pietervp
pietervp previously approved these changes Aug 30, 2023
types/Actions.d.ts Outdated Show resolved Hide resolved
@Matthiee Matthiee merged commit 0b86e65 into main Sep 5, 2023
@Matthiee Matthiee deleted the feature/EDT-1086-action-get-set branch September 5, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants