-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
43 lines (35 loc) · 999 Bytes
/
Copy pathrenderer.js
File metadata and controls
43 lines (35 loc) · 999 Bytes
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
36
37
38
39
40
41
42
43
const codeEditor = document.getElementById('codeEditor');
const logOutput = document.getElementById('logOutput');
function addLog(text, type = 'info') {
const line = document.createElement('div');
line.className = `log-line ${type}`;
line.textContent = text;
logOutput.appendChild(line);
logOutput.scrollTop = logOutput.scrollHeight;
}
function clearLog() {
logOutput.innerHTML = '';
addLog('Cleared', 'info');
}
function buildAndRun() {
const code = codeEditor.value;
if (!code.trim()) {
addLog('Please enter code', 'error');
return;
}
addLog('Building...', 'info');
window.electronAPI.buildAndRun(code);
}
window.electronAPI.onBuildLog((msg) => {
addLog(msg, 'info');
});
window.electronAPI.onBuildError((msg) => {
addLog(msg, 'error');
});
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'Enter') {
e.preventDefault();
buildAndRun();
}
});
addLog('Ready', 'success');