Skip to content

Commit fb6908a

Browse files
Openblocks-docsgitbook-bot
authored andcommitted
GITBOOK-126: Update headings in JS query
1 parent 15882c4 commit fb6908a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

docs/build-apps/write-javascript/javascript-query.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ Use a JS query to left join `query1` and `query2` on the same `tid` in the follo
5252

5353
<figure><img src="../../.gitbook/assets/js-query-2.PNG" alt=""><figcaption></figcaption></figure>
5454

55-
## How to use JS query
56-
57-
### Return data
55+
## Return data
5856

5957
Use `return` syntax to return result. For example, the following code returns `3`.
6058

@@ -72,15 +70,15 @@ return query2.run()
7270
The `return` statement is not necessary for scenarios where you want to omit results.
7371
{% endhint %}
7472

75-
### Access data
73+
## Access data
7674

7775
Use JS queries to access data in your app. Notice that there's no need to use `{{ }}` notation.
7876
7977
```javascript
8078
var data = [input1.value, query1.data, fileUpload.files[0].name];
8179
```
8280
83-
### Control component
81+
## Control component
8482
8583
In JS queries, you can use methods exposed by components to interact with UI components in your app. Such operation is not supported by the inline JS code in `{{}}`.
8684
@@ -93,9 +91,9 @@ input1.setValue("Hello");
9391
The `input1.setValue()` method (or other component methods) is asynchronous and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Promise) object. Accessing `input1.value` immediately after setting the value of `input1` does not return the updated value.
9492
{% endhint %}
9593
96-
### Run query
94+
## Run query
9795
98-
#### `run()` method and callbacks
96+
### `run()` method and callbacks
9997
10098
Call `run()` method to run other queries, for example:
10199
@@ -117,7 +115,7 @@ return queryByName.run().then(
117115
);
118116
```
119117
120-
#### Pass in parameters
118+
### Pass in parameters
121119
122120
You can pass parametes in the `run()` method to decouple query implementation from its parameters.
123121
@@ -184,7 +182,7 @@ Then trigger this query in **Run JavaScript** of event handlers in each of the i
184182
185183
You can find another demo for using passed-in paramter queries [here](https://cloud.openblocks.dev/apps/637f38daa899fe1ffcb17f0b/view).
186184
187-
### Declare a function
185+
## Declare a function
188186
189187
You can declare functions inside a JS query for better readability.
190188

0 commit comments

Comments
 (0)