0.0.4 • Published 1 year ago

@heartreup/script-loader v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@heartreup/script-loader

How to install.

# npm
npm i @heartreup/script-loader

# yarn
yarn add @heartreup/script-loader

# pnpm
pnpm add @heartreup/script-loader

Load a script synchronously or asynchronously.

Usages.

Use with callbacks.

import { loadScriptSync } from "@heartreup/script-loader";

loadScriptSync(
    'https://something.com/something/path/javascript-file.js',
    (el: HTMLScriptElement) => console.log(el),
    (ev: ErrorEvent) => console.error(ev),
);

Use with a promise.

import { loadScript } from "@heartreup/script-loader";

const load = async () => {
    const el = await loadScript('https://something.com/something/path/javascript-file.js');
}
0.0.4

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago