type TGetExternalScriptProps = { isAsync?: boolean; isDefer?: boolean; src: string; appendTo?: Node | HTMLElement; id?: string; crossorigin?: string; integrity?: string; type?: string; }; export type TGetExternalScriptArgs = Parameters; export type TGetExternalScriptReturn = ReturnType; /** * Appends an external script to the page and resolves when it's loaded. * * @param {TGetExternalScriptProps} props Options * @param {boolean} [props.isAsync=true] `async` attribute * @param {boolean} [props.isDefer=false] `defer` attribute * @param {string} props.src Script source URL * @param {Node|HTMLElement} [props.appendTo=document.body] Element to append the script to * @param {string} [props.id] Script element id * @param {string} [props.crossorigin] `crossorigin` attribute * @param {string} [props.integrity] `integrity` attribute * @param {string} [props.type] `type` attribute * @returns {Promise} Promise that resolves to the created script element * @example * getExternalScript({ src: "https://cdn.example.com/lib.js", id: "lib" }) * .then(() => console.log("Loaded")); * @example * // Load a third-party SDK with Subresource Integrity protection * await getExternalScript({ * src: "https://cdn.example.com/sdk.js", * integrity: "sha384-...", * crossorigin: "anonymous", * }); */ export declare const getExternalScript: (props: TGetExternalScriptProps) => Promise; export {};