Create a Custom JavaScript Module in PowerWeb

As of the 2022 release, we added the ability to add a custom JavaScript module to PowerWeb. This functionality allows you to add event listeners to PowerWeb and kick off custom code when an event is triggered. Additionally, you can disable user interface controls in PowerWeb when the module is active and re-enable controls when it is appropriate.

You can link to a custom JavaScript module for PowerWeb on the Settings tab of your vault settings. The following sections describe how to create the link, and the functions and events you can use when building your custom JavaScript module.

In the custom JavaScript module, you can use the JavaScript API to implement the functionality you want use. An example use case for using this API could be if you wanted to extend the PowerWeb user interface by adding external pages. In external pages, you have more freedom to develop customized functionality and user interfaces integrated with PowerWeb.

With this API, you can synchronize elements of the PowerWeb UI with actions the user is performing in your external page. For instance, with this functionality you can prevent a user from confirming a wizard before all required data is entered in the external page. For more information about external pages, see Configure External Pages.

ClosedAdd Link to Custom JavaScript Module for PowerWeb

To add a link:

  1. In Configurator, expand Environment in the configuration tree and select Vault Settings.

    The vault's settings appear in property pages in the right pane.

  2. Select the Settings tab.

  3. Click Edit.

    The Settings tab becomes editable.

  4. Add the following code to your settings:

    [PowerWeb]
    CustomURL = http://yourpage.com/
    VaultConnectionScript = Script.js

    The CustomURL can either be an absolute URL or a relative path starting from the root of the webserver hosting PowerWeb. This URL should be where you have hosted the assets that you will use in your implementation, such as the JavaScript file and any additional files, such as images.

    The VaultConnectionScript is the name of the script that will be loaded in the PowerWeb session. This is setting is specific to the current vault. If you want to implement a different script for another vault, you must do so in that vault's settings. Depending on the logic of your implementation, this script may simply contain event listeners and functions which will trigger functions under certain circumstances, or it may load other JavaScript libraries to support your application.

    After the PowerWeb page loads, the function is executed.

  5. Click Apply.

JavaScript API

2023