The addHeaderScript() method can be used to make sure the external library required by your code to run is/has been added to the page.

Syntax

bapi.helper.addHeaderScript(alias, url, runafter, ...extra)

Parameters

alias

The alias to the library used, if another one with the same alias has already been added it will go directly to the run after function handler.

runAfter

The url to the library used.

alias

The function handler required by the code to be run after the library has been loaded.

extra

The function handler required by the code to be run after the library has been loaded.

Example

const lottiePlay = () => {document.querySelector("#lottie-"+ELEMENT.id).refresh()};
bapi.helper.addHeaderScript("lottiefile", "<https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js>", lottiePlay);