mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 22:22:50 +00:00
refactor(web): disable nui focus when exiting ui
This commit is contained in:
1 parent
e699ffdbcf
commit
e2c4841368
1 file changed
+7
-1
+7
-1
@@ -7,6 +7,7 @@
|
||||
import { debugData } from './utils/debugData';
|
||||
import { visible } from './store';
|
||||
import { scale } from 'svelte/transition';
|
||||
import { fetchNui } from './utils/fetchNui';
|
||||
|
||||
interface OpenData {
|
||||
resources: string[];
|
||||
@@ -50,7 +51,12 @@
|
||||
},
|
||||
]);
|
||||
|
||||
const handleESC = (e: KeyboardEvent) => e.key === 'Escape' && ($visible = false);
|
||||
const handleESC = (e: KeyboardEvent) => {
|
||||
if (e.key !== 'Escape') return;
|
||||
|
||||
$visible = false;
|
||||
fetchNui('exit');
|
||||
};
|
||||
|
||||
$: $visible ? window.addEventListener('keydown', handleESC) : window.removeEventListener('keydown', handleESC);
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user