aboutsummaryrefslogtreecommitdiff
path: root/src/zilch/app/event.js
blob: 9183bb5cf8ee95b4292fc41999b7982aaa1a671b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
async function wasm_handle_event(target, name, event, pass_event) {
	await wasm_ready;

	const component = target.getRootNode().host;

	const handler = WebAssembly.promising(wasm.exports[name])

	if (pass_event) {
		const id = ObjectStore.generateFreeId();
		ObjectStore.registerObject(id, event);
		handler(component[ZsPtr], id);
		ObjectStore.free(event);
	} else {
		handler(component[ZsPtr]);
	}
}