Skip to content

Commit 18b8083

Browse files
committed
Remove JavaScript event listener that interfered with Go handlers
The setTimeout block manually wired up input events in JavaScript, which conflicts with the OnInput handler in the Go-generated code. JavaScript should only load WASM, not handle application logic. Changes: - Removed setTimeout block that added input event listener - Removed manual counter display updates in JavaScript - Event handling now fully managed by Go code
1 parent 620a76c commit 18b8083

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

examples/counter/index.html

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,6 @@
106106
console.log('Running WASM...');
107107
go.run(result.instance);
108108
console.log('WASM running');
109-
110-
// After WASM loads, wire up the input to update the counter
111-
setTimeout(() => {
112-
const input = document.getElementById('counter-input');
113-
const counterValue = document.querySelector('.counter-value');
114-
115-
console.log('Input element:', input);
116-
console.log('Counter value element:', counterValue);
117-
118-
if (input && counterValue) {
119-
input.addEventListener('input', (e) => {
120-
const value = e.target.value || '0';
121-
counterValue.textContent = 'Counter: ' + value;
122-
});
123-
}
124-
}, 100);
125109
})
126110
.catch((err) => {
127111
console.error('WASM load error:', err);

0 commit comments

Comments
 (0)