Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/module.ts>importScript

A JavaScript extension package for building strong and modern applications.
Latest
function importScript
import { importScript } from "https://deno.land/x/ayonli_jsext@v0.9.72/module.ts";

Imports a script from the given URL to the current document, useful for loading 3rd-party libraries dynamically in the browser.

NOTE: This function is only available in the browser.

Examples

Example 1

import { importScript } from "@ayonli/jsext/module";

await importScript("https://code.jquery.com/jquery-3.7.1.min.js");

console.assert(typeof jQuery === "function");
console.assert($ === jQuery);

Parameters

url: string
optional
options: { type?: "classic" | "module"; } = [UNSUPPORTED]

Returns

Promise<void>