mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 17:53:00 +02:00
@@ -0,0 +1,13 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
interface IProps {
|
||||
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
||||
}
|
||||
|
||||
export function KeyHandler(props: IProps): React.ReactElement {
|
||||
let elem: any;
|
||||
useEffect(() => elem.focus());
|
||||
|
||||
// invisible autofocused element that eats all the keypress for the minigames.
|
||||
return (<div tabIndex={1} ref={c => elem = c} onKeyDown={props.onKeyDown} />)
|
||||
}
|
||||
Reference in New Issue
Block a user