Table of Contents

ViziApps Javascript Templates

ViziApps supports a master library of JavaScript functions that can be included in all ViziApps projects.

A special user called apps_javascript creates templates of JavaScript Libraries.

The method by which this is done is to create a ViziApps app for every shareable JavaScript library within the special apps_javascript account. Each apps JavaScript section will become a master template. Any other attributes of this app are ignored.

Create a JavaScript Library

1. Login to the user called apps_javascript, either via the Admin account or directly with the password from the ViziApps team.

2, Click on the “Create a new app” icon and provide the name for the app. This name will be the JavaScript file name that will be used in the ViziApps Studio by other builders.

3. When creating the app, use a lower-case name. Also, create a description that will appear when the app is included in the projects of the customers. Including a link to documentation for the app can also be helpful. When the JavaScript module appears to builders, it will have a “.js” appended to it (you don’t need to include it in the file name).

4. Click the Javascript widget to write the Custom JavaScript master module code.

At this point, you may edit the JavaScript module in the standard Javascript window. When you are done, click Save.

Publishing and Activating JavaScript Modules

The “apps_javascript” user has the ability to make the individual JavaScript modules visible to all users. The first step is to “Publish” the modules. This will make them visible in the “HTML Header” section for all users. In addition, the JavaScript modules can be made either “ACTIVE” or “INACTIVE”.

Click the Edit JS Libraries button in the toolbar to bring up the modal window.

The following is a summary of the three possible states for each JavaScript module:

1. UNPUBLISHED - The file is not visible in “HTML Header” section. This is the default after a new module is created.

2. ACTIVE - The file will be visible in “HTML Header” for other builders as active (i.e., not commented out).

3. INACTIVE - The file will be visible in “HTML Header” for other builders, but is commented out (i.e., not active).

Use the check-boxes for each JavaScript module to set the published and active status. Changes are immediate, and will be acknowledged with a brief overlay message.

Deleting JavaScript Modules

The apps_javascript user can delete an app which is in the “UNPUBLISHED” state. To delete a “PUBLISHED” app, the library app should be changed to “UNPUBLISHED” state.

WARNING: If a builder has included a JavaScript module in their project, deleting a module can cause unexpected errors in the published application.

Builder View of JavaScript Modules

Builders can see the JavaScript libraries from the library by clicking the “HTML Header” widget.

New apps will have the current JavaScript libraries. Existing apps will not include any newly added modules.

In this case, the builder should click Reset Custom HTML Header, which will load the latest JavaScript library modules.

Builders may choose to include JavaScript modules or not by commenting the “<script>” section in or out. However, if a particular module is not used in the builder application there is no usually no harm in including the file. The main reason why “commenting out” a module may be needed is for developers who may be debugging their own JavaScript modules.