Loading Assets

To load an array of external JavaScript files into the current page, use the asynchronous wire.loadJs function. The function will return context to the caller when all files have been loaded successfully on the page.

// TypeScript
await wire.loadJs( ["file1.js", "file2.js"] );

// JavaScript
wire.loadJs( ["file1.js", "file2.js"], () => {
    ...
});

To load an external CSS file into the current page, use the wire.loadCss function. The function will return context to the caller when the file has been loaded successfully on the page.

// TypeScript
await wire.loadCss("file1.css");

// JavaScript
wire.loadCss("file1.css", () => {
    ...
});

Last updated