MCPcopy Index your code
hub / github.com/codeaashu/claude-code / useBlink

Function useBlink

src/hooks/useBlink.ts:22–34  ·  view source on GitHub ↗
(
  enabled: boolean,
  intervalMs: number = BLINK_INTERVAL_MS,
)

Source from the content-addressed store, hash-verified

20 * }
21 */
22export function useBlink(
23 enabled: boolean,
24 intervalMs: number = BLINK_INTERVAL_MS,
25): [ref: (element: DOMElement | null) => void, isVisible: boolean] {
26 const focused = useTerminalFocus()
27 const [ref, time] = useAnimationFrame(enabled && focused ? intervalMs : null)
28
29 if (!enabled || !focused) return [ref, true]
30
31 // Derive blink state from time - all instances see the same time so they sync
32 const isVisible = Math.floor(time / intervalMs) % 2 === 0
33 return [ref, isVisible]
34}
35

Callers 1

ToolUseLoaderFunction · 0.85

Calls 2

useTerminalFocusFunction · 0.85
useAnimationFrameFunction · 0.85

Tested by

no test coverage detected