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

Adds callFunc as member method to Custom Components #929

Merged
merged 7 commits into from Oct 10, 2023

Conversation

markwpearce
Copy link
Collaborator

  • Custom Components have callFunc member
  • Adds isVariadic flag to TypedFunctionType, because CallFunc() may have any number of arguments
  • CallFunc is handled in a custom way in the code, because it does not exist in a built-in interface.

@@ -2278,7 +2278,7 @@ describe('Program', () => {
expectTypeToBe(table.getSymbolType('ifDeviceInfo', opts).getMemberType('GetRandomUUID', rtOpts), TypedFunctionType);

expectTypeToBe(table.getSymbolType('ifSGNodeField', opts), InterfaceType);
expectTypeToBe(table.getSymbolType('ifSGNodeField', opts).getMemberType('observeField', rtOpts), TypedFunctionType);
expectTypeToBe(table.getSymbolType('ifSGNodeField', opts).getMemberType('addFields', rtOpts), TypedFunctionType);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to change this because there observeField is overloaded, so it is actually a UnionType... see: #926

CallFuncMemberMethod.isVariadic = true;

// Taken from: https://developer.roku.com/en-ca/docs/developer-program/core-concepts/handling-application-events.md#functional-fields
export const CallFuncDescription = `callFunc() is a synchronized interface on roSGNode. It will always execute in the component's owning ScriptEngine and thread (by rendezvous if necessary), and it will always use the m and m.top of the owning component. Any context from the caller can be passed via one or more method parameters, which may be of any type (previously, callFunc() only supported a single associative array parameter).\n\nTo call the function, use the \`callFunc\` field with the required method signature. A return value, if any, can be an object that is similarly arbitrary. The method being called must determine how to interpret the parameters included in the \`callFunc\` field.`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to move this into the scrape-roku-docs.ts instead, so it shows up in the data.json? Just add a hardcoded function. That way this data flows the same as all the others.

@markwpearce markwpearce merged commit 725c3c6 into release-0.66.0 Oct 10, 2023
5 checks passed
@markwpearce markwpearce deleted the components_have_callfunc_member branch October 10, 2023 19:33
@TwitchBronBron TwitchBronBron added this to the v1.0.0 milestone Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants