Use third-party libraries in Apps
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 you time as you do not need to develop the functionality that the library provides. Lowcoder provides some built-in third-party libraries for common uses, and you can manually import other libraries on demand.
Built-in libraries
Lowcoder provides some JavaScript built-in libraries for use.
lodash
Powerful utility functions for Arrays, Collections, JS Functions, JS Objects, Strings, Numbers, Math, Sequences
4.17.21
uuid
9.0.0(Support v1/v3/v4/v5)
numbro
Powerful Number formatting helper
2.3.6
papaparse
Parser for CSV to JSON
5.3.2
Built-in Libraries can be used directly everywhere where you can use JavaScript.
Import third-party libraries
Lowcoder supports setting up preloaded JavaScript and libraries, which can either be imported for individual apps or the whole workspace.
As soon as imported/bound to an App or workspace, Lowcoder manages the pre-loading of these libraries automatically in the editor and app view.
App-level libraries get loaded only in the app where they were defined. This means a library imported to app A is not loaded for app B. The reverse is also true. A library imported for app B is not available to app A unless it is explicitly imported to app A as well.
Workspace-level libraries will be loaded when you open any application in your workspace. All apps can access (and will load automatically) those libraries.
importing third-party libraries can impact app performance, especially when you have complex JavaScript functions. Decide carefully to import on the App-level or on Workspace-level
Now let's take cowsay as an example and import it at the app level and the workspace level.
Import / bind at the app level
Navigate to the settings page and then click the plus sign + under the JavaScript library tab. Paste the library link and click Add New. Lowcoder will now check, if the external library will be compatible and securely usable.
You can also click the download icon to quickly download any recommended JS library.
Now, you can create a JS query and insert code.
Note that the cowsay library is imported in our example at app-level and you can not use it in any other app within your workspace.
You should see something similar to the image below after successfully importing the cowsay library. Note that you see what global variable you can use to access the library.
Imported external libraries are bound to the window object. cowsay.say(...) will not work window.cowsay.say(...) - does the job.
Import/bind at the workspace level
Last updated
Was this helpful?