Skip to content

loadComponentLibrary

Updated pdexter 2022-10-22

Loads a library object from a Formbird component, so as to be able to manipulate/query a field on screen.

This requires knowledge of the specific component, and what library service and function it offers.

(client-side function)

Syntax

ft3.loadComponentLibrary(service-name, function(error-message, library) {

  ...

})

Part Description
service-name Name of the component library to load.
error-message Error message string if the load fails.
Null if successful.
library The library object returned by the function.

Example

// -----------------------------------------------------------------
// Wrapper function to update layers on the sc-address-map component.
// -----------------------------------------------------------------
updateMapLayers : function (ntf, componentType, componentName, newLayers, callbackF) {
    var ft3 = ntf.scope;

    ft3.loadComponentLibrary('sclMapRulesInterface', function (errMsg, mapLibrary) {
        if (errMsg) {
            ntf.logger.error('Error in calling MapLibrary: ' + errMsg);
            callbackF(false);
        }
        else {
            ntf.logger.info('MapLibrary called.');

            mapLibrary.setMapLayers(componentType, componentName, newLayers);

            callbackF(true);
        }
    });
}