...
Note | ||
---|---|---|
| ||
Developers who are familiar with Javascript may cite issues with browser support and speed of execution. However, it is worth noting that Servoy does not deploy any Javascript. All code written in Servoy is deployed using Mozilla's Rhino project, which is an open-source, Java-based Javascript implementation. This means that:
|
...
Scope defines the domain in which code is executed and subsequently determines the namespace by which scripted objects are referenced. Javascript code (functions and variables) may be defined in the following two scopes:
Global Scope: Accessible Found in the globals.js file and accessible via the namespace globals, i.e.
Code Block |
---|
globals.createNewCustomer(); // invokes the global method |
Form Scope: Accessible Found in the formName.js file and accessible via the namespace forms.formName, i.e.
...
...
...
Tip | ||
---|---|---|
| ||
Any scripting API (including methods written by a developer) can be auto-completed using key strokes. To use auto-complete, begin typing the code you wish to execute, then hit ctrl+space on the keyboard. A type-ahead list of available scripting objects will appear for you to choose from as you type. This is a highly productive and accurate way to write code when you have become more familiar with the APIs. |
Tip | ||
---|---|---|
| ||
If you are unfamiliar with Javascript syntax, that's OK. In the Solution Explorer, navigate to the JS Lib node. This object contains a list of APIs for dealing with the Javascript language and native data types. It even contains syntax completion for common statements in the Statements node. |