Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function useStdin(
keyHandler: ({ actionKey: ActionKey, text: string, key: Key }) => void,
deps: any[] = [],
) {
let { stdin, setRawMode } = inkUseStdin()
// stdin = stdin || process.stdin
// setRawMode = setRawMode || process.stdin.setRawMode
emitKeypressEvents(stdin)
let didCancel = false
React.useEffect(() => {
function handler(text: string, key: Key) {
if (!didCancel) {
keyHandler({ actionKey: action(key), text, key })
}
}
setRawMode!(true)