methodCall
Description
Runs the method using the object assigned in context parameter.
Input / Parameter
context
This is the context (object) that the method will run on.
Object
-
-
Yes
method
The method to run or call.
Object
-
-
Yes
arguments
The arguments that will be passed to method.
Array/List
-
-
Yes
Output
The return type of methodCall depends on the function that is passed as the method. Specifically, it will return the result of invoking the method with the given context and arguments.
Any
Example
In this example, we will use function methodCall to add a new div element in the document body by getting document object using resolveJSName function.
Code Equivalent
// Create div element
var div = document.createElement("div");
// Add some attribute to the div
div.className = "class";
// Add to the body
document.body.appendChild(div);Steps
Drag a
buttoncomponent into the canvas and open theActiontab. Select thepressevent of the button and drag thesetVarfunction to the event flow.On
setVarfunctionvarparam adddivas the value and on it'svalueparam add a subflow and drag a functionmethodCall.On it's
contextparam add a subflow and drag a functionresolveJSName, on it'snameparam add the valuedocument.
On it's
methodparam add a subflow and drag a functionobjectAttr, on it'sobjectparam add a subflow and drag a functionresolveJSName, on it'snameparam add the valuedocument. Back on the functionobjectAttron it'sattrparam add the valuecreateElement.
On it's
argumentsparam add a subflow and drag a functiontoArray, on it'svalue1param add the valuediv.
Back to main flow, drag the
setObjectAttrfunction to the event flow, on it'sobjectparam add a subflow and drag a functiongetVar, on it'svarparam add the valuediv. As for theattrparam add the valueclassNameand for thevalueparam add the valueclass.
Back to main flow, drag the
methodCallfunction to the event flow, on it'scontextparam add a subflow and drag a functionresolveJSName, on it'snameparam add the valuedocument.body.
On it's
methodparam add a subflow and drag a functionobjectAttr, on it'sobjectparam add a subflow and drag a functionresolveJSName, on it'snameparam add the valuedocument.body. Back on the functionobjectAttron it'sattrparam add the valueappendChild.
On it's
argumentsparam add a subflow and drag a functiontoArray, on it'svalue1param add a subflow and drag a functiongetVar, on it'svarparam add the valuediv.
Result
Now click the button in preview, check the inspector, you will see a new div element being added on the body

Links
Related Information
See also:
Functions
Last updated