Skip to content

Function: require()

ts
function require(file, callback): void;

Dynamically load a JavaScript file and execute a callback function.

Parameters

ParameterTypeDescription
filestringThe URL of the JavaScript file to load.
callback(ev) => anyThe callback function to execute when the script is loaded.

Returns

void

Example

ts
requireScript('path/to/script.js', () => {
  console.log('Script loaded');
});

Since

1.0.0

Released under the MIT License.