We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 09f6c10 + 21ccbb8 commit a282a01Copy full SHA for a282a01
index.d.ts
@@ -0,0 +1,12 @@
1
+type Callback = (errorOrNull: Error | null, script: HTMLScriptElement) => void;
2
+
3
+type AllowedAttributes = 'type' | 'charset' | 'async' | 'text';
4
5
+type Options = Partial<Pick<HTMLScriptElement, AllowedAttributes>> & {
6
+ attrs?: Record<string, string>;
7
+}
8
9
+declare function load (src: HTMLScriptElement['src'], opts: Callback): void;
10
+declare function load (src: HTMLScriptElement['src'], opts: Options, cb: Callback): void;
11
12
+export default load;
package.json
@@ -1,7 +1,8 @@
{
"name": "load-script",
"description": "Dynamic script loading for browser",
- "version": "1.0.0",
+ "version": "2.0.0",
+ "types": "./index.d.ts",
"keywords": [
"browser",
"script",
0 commit comments