App user functions

In addition to the app properties and the app methods, as well the controls properties and methods, and, the integrated Apache Cordova plugins properties and methods, you can also add your own app functions. The existing app user functions are also integrated in the IDE Quick code list.

The app user functions can be a good way, for example, to share some pieces of code along the app, since you can call to that app user functions from any app view, app dialog, etc. The DecSoft App Builder IDE provides you an app user functions manager, and, you can define any number of app user functions.

Take a look at the below animated GIF image, in which you can see how to create a new app user function and then use it.

Where the functions are placed

The user functions that you add to the app are placed in the "app" scoped, as any other method of the app, so, if you add a "sayHello" user function, you can call to that function with the below code:

Function variables

The below JavaScript variables are available in all the user functions:

Name Type Description
view Object

Stores the current app view or dialog. This variable allow us to access to that view or dialog properties and methods and also their controls properties and methods. For example, you can access to a control properties using the variable "view.yourControlName", suposing the control is named "yourControlName".

views Object Stores all the loaded app views. Note that loaded views mean that the app views has been previously show to the user. It's possible to access to the app view controls properties like "views.view1.yourControlName", suposing the view is named "view1" and the control is named "yourControlName". In the same way we can access to other controls of the view and to other loaded views and their controls.
frames Object Stores all the app frames. You can use this variable to access to all the app frames and their controls.
dialogs Object Stores all the app dialogs. You can use this variable to access to all the app dialogs and their controls.
app Object Stores all the app properties and methods. You can use this variable to access to all the app properties and app methods.