Plugin bundled files

Files bundled in the plugin’s file directory are intended for storing small resources.

It’s recommended you use bundled files for storing form specifications, which are lazily loaded when you use the plugin’s form() method.

Interface

function loadFile(pathname)

Load a file from the plugin’s file directory, returning a BinaryData object.

Example

To lazily load a lookup table from the file/lookup/departments.json, use code like:

var departmentsLookupCached;
var getDepartmentsLookup() {
    if(!departmentsLookupCached) {
        departmentsLookupCached =
          P.loadFile("lookup/departments.json").readAsJSON();
    }
    return departmentsLookupCached;
}