useExitOnCtrlCDWithKeybindings.ts
hooks/useExitOnCtrlCDWithKeybindings.ts
No strong subsystem tag
25
Lines
948
Bytes
1
Exports
2
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 25 lines, 2 detected imports, and 1 detected exports.
Important relationships
Detected exports
useExitOnCtrlCDWithKeybindings
Keywords
useexitonctrlcdusekeybindingsexitstateparamonexitoninterruptisactivekeybindingsoptionalexit
Detected imports
../keybindings/useKeybinding.js./useExitOnCtrlCD.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { useKeybindings } from '../keybindings/useKeybinding.js'
import { type ExitState, useExitOnCtrlCD } from './useExitOnCtrlCD.js'
export type { ExitState }
/**
* Convenience hook that wires up useExitOnCtrlCD with useKeybindings.
*
* This is the standard way to use useExitOnCtrlCD in components.
* The separation exists to avoid import cycles - useExitOnCtrlCD.ts
* doesn't import from the keybindings module directly.
*
* @param onExit - Optional custom exit handler
* @param onInterrupt - Optional callback for features to handle interrupt (ctrl+c).
* Return true if handled, false to fall through to double-press exit.
* @param isActive - Whether the keybinding is active (default true).
*/
export function useExitOnCtrlCDWithKeybindings(
onExit?: () => void,
onInterrupt?: () => boolean,
isActive?: boolean,
): ExitState {
return useExitOnCtrlCD(useKeybindings, onInterrupt, onExit, isActive)
}