ebs.injectScriptAsync
Asynchronously injects an external JavaScript file.
The function works by inserting a <script src="..."> </script> element in the form's HTML code.
Syntax
Copy
function ebs.injectScriptAsync(url: string): Promise<void>
| Parameter | Type | Description |
|---|---|---|
url
|
string | URL for an external JavaScript file. |
Response
Returns a void promise object, allowing you to associate handlers in case of success or failure.
Examples
In this example:
- We import the Bootstrap Bundle JavaScript source file https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js.
- If the import is successful, we log a success message in the browser console.
Copy
ebs.injectScriptAsync('https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js')
.then(console.log('Bootstrap loaded successfully.'));