Call a Function¶
On this page
Overview¶
You can call a function from other parts of your Stitch application or from a connected client application.
Usage¶
The examples in this section demonstrate calling a simple function named
sum
that takes two arguments, adds them, and returns the result:
Call from Another Function¶
You can call a function from another function, including incoming
webhooks and triggers, by accessing function context with the context.functions
global variable:
For additional information, see the Function Context reference page.
Call from a JSON Expression¶
You can call a function from a Stitch JSON Expression, including service rules, by using the
%function
operator:
Call from a Client Application¶
You can call a function from client applications that are connected with a Client SDK or over the wire protocol.
- JavaScript SDK
- Android SDK
- iOS SDK
To execute a function from a JavaScript Client SDK, use the callFunction() method.
To execute a function from the Android Client SDK, use the callFunction() method.
To execute a function from the iOS Client SDK, use the callFunction(withName:withArgs:_:) method.