@@ -32,7 +32,10 @@ export function createScript(info: {
32
32
cb ?: ( value : void | PromiseLike < void > ) => void ;
33
33
attrs ?: Record < string , any > ;
34
34
needDeleteScript ?: boolean ;
35
- createScriptHook ?: ( url : string ) => CreateScriptHookReturn ;
35
+ createScriptHook ?: (
36
+ url : string ,
37
+ attrs ?: Record < string , any > | undefined ,
38
+ ) => CreateScriptHookReturn ;
36
39
} ) : { script : HTMLScriptElement ; needAttach : boolean } {
37
40
// Retrieve the existing script element by its src attribute
38
41
let script : HTMLScriptElement | null = null ;
@@ -55,7 +58,7 @@ export function createScript(info: {
55
58
script . type = 'text/javascript' ;
56
59
script . src = info . url ;
57
60
if ( info . createScriptHook ) {
58
- const createScriptRes = info . createScriptHook ( info . url ) ;
61
+ const createScriptRes = info . createScriptHook ( info . url , info . attrs ) ;
59
62
60
63
if ( createScriptRes instanceof HTMLScriptElement ) {
61
64
script = createScriptRes ;
@@ -202,7 +205,10 @@ export function loadScript(
202
205
url : string ,
203
206
info : {
204
207
attrs ?: Record < string , any > ;
205
- createScriptHook ?: ( url : string ) => CreateScriptHookReturn ;
208
+ createScriptHook ?: (
209
+ url : string ,
210
+ attrs ?: Record < string , any > | undefined ,
211
+ ) => CreateScriptHookReturn ;
206
212
} ,
207
213
) {
208
214
const { attrs = { } , createScriptHook } = info ;
0 commit comments