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
Conversation
@@ -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); |
There was a problem hiding this comment.
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
src/types/ComponentType.ts
Outdated
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.`; |
There was a problem hiding this comment.
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.
callFunc
memberisVariadic
flag toTypedFunctionType
, because CallFunc() may have any number of arguments