How to add your own custom JS libraries for custom visuals

For custom visuals sometimes you want to use external / different Javascript libraries that are not shipped with Arcadia.

You can override or add custom JS libraries as part of Custom Styles by using the addScripts API endpoint. Below is an example of how the syntax works:

return function() {

var f = function() {};

f.version = "1";

f.afterDraw = function () {

  var convertDateTimezone = function() {
    // this function will do something and use the moment timezone library

  };

  // This function add in script elements for the additional libraries specified in the filepaths array. The callback function is invoked after load completes.

  arcapi.addScripts([
        "https://momentjs.com/downloads/moment-timezone.js",
  ], convertDateTimezone);

};

return f;
}();
1 Like