Skip to content

Commit 71a7d77

Browse files
committed
docs: updates jsdoc comments
1 parent 6462302 commit 71a7d77

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/loadScript.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import type { Blocking, CrossOrigin, FetchPriority, ReferrerPolicy, ScriptType } from "./types";
22

3+
/**
4+
* Options for loading a script.
5+
*
6+
* @see {@link loadScript}
7+
*/
38
export type LoadScriptOptions = {
49
/** Optional ID for DOM targeting or deduplication */
510
readonly id?: string;
@@ -70,21 +75,12 @@ export const __resetScriptCache = () => {
7075
*
7176
* @example
7277
* ```ts
73-
* onMount(async () => {
74-
* const script = await loadScript(
75-
* "https://example.com/library.js",
76-
* {
77-
* async: true,
78-
* type: "text/javascript",
79-
* },
80-
* document.body
81-
* );
82-
* console.log("Script loaded:", script.src);
83-
* });
78+
* const script = await loadScript("https://example.com/library.js", { type: "module" }, document.head);
79+
* console.log("Script loaded:", script.src);
8480
* ```
8581
*
8682
* @param src - The script URL to load.
87-
* @param attributes - HTML script attributes (e.g. async, type, innerHTML).
83+
* @param options - additional options for the script (e.g. async, type, textContent).
8884
* @param target - Optional DOM element to append the script to (defaults to `document.head`).
8985
* @returns A Promise that resolves to the script element.
9086
*/

0 commit comments

Comments
 (0)