mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
18 lines
461 B
TypeScript
18 lines
461 B
TypeScript
export const loadScript = (src: string, container: HTMLElement | null) => {
|
|
const script = document.createElement("script");
|
|
|
|
script.setAttribute("async", "");
|
|
script.src = src;
|
|
container && container.appendChild(script);
|
|
|
|
return script;
|
|
};
|
|
|
|
export const removeScript = (
|
|
script: HTMLScriptElement | HTMLElement,
|
|
container: HTMLElement | null,
|
|
) => {
|
|
if (script.parentNode != container) return;
|
|
container && container?.removeChild(script);
|
|
};
|