MCPcopy Create free account
hub / github.com/anus-dev/ANUS / useKeypress

Function useKeypress

packages/cli/src/ui/hooks/useKeypress.ts:24–40  ·  view source on GitHub ↗
(
  onKeypress: KeypressHandler,
  { isActive }: { isActive: boolean },
)

Source from the content-addressed store, hash-verified

22 * @param options.isActive - Whether the hook should be actively listening for input.
23 */
24export function useKeypress(
25 onKeypress: KeypressHandler,
26 { isActive }: { isActive: boolean },
27) {
28 const { subscribe, unsubscribe } = useKeypressContext();
29
30 useEffect(() => {
31 if (!isActive) {
32 return;
33 }
34
35 subscribe(onKeypress);
36 return () => {
37 unsubscribe(onKeypress);
38 };
39 }, [isActive, onKeypress, subscribe, unsubscribe]);
40}

Callers 15

IdeIntegrationNudgeFunction · 0.85
AppFunction · 0.85
InputPromptFunction · 0.85
EditorSettingsDialogFunction · 0.85
DebugProfilerFunction · 0.85
AuthInProgressFunction · 0.85
ApiKeyInputFunction · 0.85
ShellConfirmationDialogFunction · 0.85
SettingsDialogFunction · 0.85
ThemeDialogFunction · 0.85
FolderTrustDialogFunction · 0.85
RadioButtonSelectFunction · 0.85

Calls 1

useKeypressContextFunction · 0.85

Tested by

no test coverage detected