-
Notifications
You must be signed in to change notification settings - Fork 7
/
renderer.js
35 lines (30 loc) · 874 Bytes
/
renderer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { useEffect } from 'react';
import { ipcRenderer } from 'electron';
function App() {
useEffect(() => {
// Disable specific key events in the renderer process
const handleKeyDown = (e) => {
const forbiddenKeys = ['F11', 'Alt', 'Control', 'Meta', 'Escape'];
if (
e.altKey ||
e.ctrlKey ||
e.metaKey ||
forbiddenKeys.includes(e.key)
) {
e.preventDefault();
ipcRenderer.send('prevent-key', e.key); // Send the key to the main process if needed
}
};
window.addEventListener('keydown', handleKeyDown);
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, []);
return (
<div className="App">
{/* Your React components here */}
<h1>Exam Interface</h1>
</div>
);
}
export default App;