mount-script
Version:
A simple function for mounting javascript
25 lines (20 loc) • 776 B
TypeScript
export declare interface HTMLScriptElementEX extends HTMLScriptElement {
onreadystatechange?: any;
readyState?: 'loaded' | 'complete';
}
export declare interface JsOptions {
attrs?: ScriptAttributes;
props?: ScriptAttributes;
force?: boolean;
}
/**
* Dynamic loading of js linked resources
*
* @param src - resource address
* @param option - parameters: attrs, props, force
* @returns - result
*/
declare function mountScript(src: string, option?: JsOptions): Promise<boolean>;
export default mountScript;
export declare type ScriptAttributes = Pick<HTMLScriptElement, 'async' | 'charset' | 'crossOrigin' | 'defer' | 'event' | 'htmlFor' | 'integrity' | 'noModule' | 'referrerPolicy' | 'src' | 'text' | 'type'>;
export { }