-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathcall-a-function.txt
47 lines (32 loc) · 1.26 KB
/
call-a-function.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.. _web-call-a-function:
=========================
Call a Function - Web SDK
=========================
.. contents:: On this page
:local:
:backlinks: none
:depth: 3
:class: singlecol
Overview
--------
You can call a :ref:`Function <functions>` from a connected client application.
The examples in this section demonstrate calling a simple function named
``sum`` that takes two arguments, adds them, and returns the result:
.. literalinclude:: /examples/generated/web/call-a-function.test.snippet.function.js
:language: javascript
Usage
-----
In the Node SDK you call Functions as a logged in user with the
``User.functions`` interface. There are two ways to call a function:
- You can call a function as if was a method defined locally on the
``User.functions`` interface.
- You can call the ``User.functions.callFunction()`` method to call a function
by providing its stringified name and a list of arguments.
Call a Function
~~~~~~~~~~~~~~~
.. literalinclude:: /examples/generated/web/call-a-function.test.snippet.call-function.js
:language: javascript
Call a Function Programmatically
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. literalinclude:: /examples/generated/web/call-a-function.test.snippet.call-function-programmatically.js
:language: javascript