let _push: ((path: string) => void) | null = null;

export function registerNavigator(push: (path: string) => void) {
  _push = push;
}

export function navigateTo(path: string) {
  if (_push) _push(path);
  else if (typeof window !== "undefined") window.location.href = path;
}
