import { useEffect } from "react";

declare global {
  interface Window {
    $WowheadPower?: { refreshLinks: () => void };
  }
}

export function useWowheadTooltips(deps: unknown[] = []) {
  useEffect(() => {
    const timer = setTimeout(() => {
      window.$WowheadPower?.refreshLinks();
    }, 150);
    return () => clearTimeout(timer);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, deps);
}
