Adding JavaScript code to Pega Platform applications
Customize how your offline offline-enabled mobile app stores and synchronizes data by adding JavaScript code to your Pega Platform application.
For example, you can decrease the default synchronization frequency to limit battery consumption and network usage.- In the header of Dev Studio, click .
- On the Create Text File tab, in the Text File
Record Configuration section, configure the text file:
- In the Label field, enter a name for the text file.
- In the App Name (Directory) field, enter webwb.
- In the File Type (extension) field, enter js.
- In the Context section, specify the branch and ruleset for the file.
- Click Create and open.
- On the Main tab, in the text field, enter the JavaScript
code that you want to include in your application.For more information, see JavaScript APIs for offline-enabled mobile apps.
- In the upper-right corner of the screen, click Save.
- In the navigation pane of Dev Studio, click Records.
- Expand the Technical category and click Static Content Bundle.
- In the Bundle Name column, open the configuration tab for the rule by clicking pypega_ui_userscripts_offline.
- On the Definition tab, click the Add item icon.
- In the added row, add the JavaScript code to the UI rule:
- In the App name field, enter webwb.
- In the File extension field, enter js.
- In the File name field, enter the name of the text file that contains the JavaScript code.
- Check out the pypega_ui_userscripts_offline rule to your
development branch:
- Click the arrow next to the Private edit button, and then select Check out to branch.
- In the Check Out to Branch dialog box, in the Branch menu, select the branch that you created.
- Click Check out to branch.
- In the upper-right corner of the screen, click Save.
Creating a text file that holds the JavaScript code
Adding the JavaScript code to the text file
Adding the text file to your application
Previous topic JavaScript APIs for offline-enabled mobile apps Next topic Securing mobile apps