export const createScript = (
  src: string,
  success: () => void,
  error: () => void
) => {
  const script = document.createElement("script");
  script.async = true;
  script.defer = true;
  script.src = src;
  script.onerror = error;
  script.onload = success;
  document.querySelector("head")?.appendChild(script);
};
