Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

708 B
Raw Blame
/** A short pause prevents passing over a row from changing the menu, and bridges the gap to its child. */
export const SUBMENU_HOVER_MS = 150

export function submenuHover(change: (index: number | null) => void) {
  let pending: ReturnType<typeof setTimeout> | undefined
  let target: number | null | undefined
  const cancel = () => {
    clearTimeout(pending)
    pending = undefined
    target = undefined
  }
  return {
    cancel,
    schedule(index: number | null) {
      if (pending && target === index) return
      cancel()
      target = index
      pending = setTimeout(() => {
        pending = undefined
        target = undefined
        change(index)
      }, SUBMENU_HOVER_MS)
    },
  }
}