add close handler
This commit is contained in:
parent
258cef324f
commit
fac673c048
|
@ -20,6 +20,15 @@ function App() {
|
|||
const UISetting = await fetchNui<UISetting>('AppReady');
|
||||
setSetting(UISetting);
|
||||
}, 2000);
|
||||
const keyHandler = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') {
|
||||
fetchNui('close');
|
||||
}
|
||||
};
|
||||
window.addEventListener('keydown', keyHandler);
|
||||
return () => {
|
||||
window.removeEventListener('keydown', keyHandler);
|
||||
};
|
||||
}
|
||||
}, [setSetting]);
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue
Block a user