Skip to content

Commit 628b52d

Browse files
Openblocks-docsgitbook-bot
Openblocks-docs
authored andcommitted
GitBook: [#62] No subject
1 parent 441b812 commit 628b52d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/build-apps/use-third-party-libraries.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Every developer learns one of the most important principles of software engineering early in their career: DRY (Don’t Repeat Yourself). Using third-party libraries can save your time as you do not need to develop the functionality that the library provides. Openblocks provides some built-in third-party libraries for common uses, and you can manually import other libraries on demand.
44

5-
### Built-in third-party libraries
5+
### Built-in libraries
66

77
Openblocks provides some JavaScript built-in libraries for use:
88

@@ -14,20 +14,20 @@ Openblocks provides some JavaScript built-in libraries for use:
1414
| numbro | [https://numbrojs.com/format.html](https://numbrojs.com/format.html) | 2.3.6 |
1515
| papaparse | [https://www.papaparse.com/docs](https://www.papaparse.com/docs) | 5.3.2 |
1616

17-
### Manually import third-party libraries
17+
### Manually import libraries
1818

1919
Openblocks supports setting up preloaded JavaScript and libraries which can be **app-level** or **workspace-level**.
2020

21-
* **App-level** JavaScript **** gets loaded only in the app where defined. Plus, app A cannot use libraries that are set up for app B.
22-
* **Workspace-level** JavaScript **** will be loaded when you open any application in your workspace. All the apps can access those libraries. There can be a certain impact on app performance, especially when you have complex JavaScript functions that aren't being used in every app.
21+
* **App-level** libraries **** get loaded only in the app where defined. Plus, app A cannot use libraries that are set up for app B.
22+
* **Workspace-level** libraries **** will be loaded when you open any application in your workspace. All the apps can access those libraries. There can be a certain impact on app performance, especially when you have complex JavaScript functions that aren't being used in every app.
2323

2424
{% hint style="info" %}
2525
**Tips you should know before setting up libraries:**
2626

2727
* External libraries are loaded and run in the browser.
2828
* NodeJS-only libraries are not supported now.
2929
* URLs of external libraries need to support cross-domain.
30-
* The export of the library must be set directly on the window object, global variables like (var xxx = xxx) do not take effect.
30+
* The export of the library must be set directly on the window object, global variables like `var xxx = xxx` do not take effect.
3131
* The external libraries run in a restricted sandbox environment and the following global variables are not available:
3232

3333
<mark style="background-color:yellow;">`parent`</mark>
@@ -63,7 +63,7 @@ Now let's take **cowsay** as an example and import it on app-level and workspace
6363
* GitHub page: [https://github.com/piuccio/cowsay](https://github.com/piuccio/cowsay)
6464
* Library link: [https://unpkg.com/cowsay@1.5.0/build/cowsay.umd.js](https://unpkg.com/cowsay@1.5.0/build/cowsay.umd.js)
6565

66-
#### Import on App-level
66+
### Import on App-level
6767

6868
Navigate to the left sidebar, click <img src="../.gitbook/assets/image (1).png" alt="" data-size="line"> > **Other** > **Scripts and style** > **Add a library**. Then paste the **cowsay** link here.
6969

@@ -73,15 +73,15 @@ Now you can write code in **JS query** to test its usage with `cowsay.say`:
7373

7474
<figure><img src="../.gitbook/assets/write code in JS query (2).png" alt=""><figcaption></figcaption></figure>
7575

76-
or in **Properties** to use:
76+
or in component **Properties**:
7777

7878
<figure><img src="../.gitbook/assets/or in Properties (2).png" alt=""><figcaption></figcaption></figure>
7979

8080
And since you have set up cowsay just for **Openblocks's new application 1,** you can not use cowsay in another app.
8181

8282
<figure><img src="../.gitbook/assets/in another app (1).png" alt=""><figcaption></figcaption></figure>
8383

84-
#### Import on Workspace-level libraries
84+
### Import on Workspace-level libraries
8585

8686
Navigate to **Workspace settings** > **Advanced** > **JavaScript library** > **Add a library**. Then paste the **cowsay** link here and click **Save**. Now you can use **cowsay** library **** in any app of your workspace.\
8787
![](<../.gitbook/assets/Import on Workspace-level libraries (1).png>)

0 commit comments

Comments
 (0)