wait event stuff for wasm backend
This commit is contained in:
parent
0f7c34a5ad
commit
4eb872944a
3 changed files with 49 additions and 3 deletions
|
|
@ -28,9 +28,19 @@
|
|||
let update = function() {{
|
||||
if (!frame) return;
|
||||
instance.exports.wasmUpdate();
|
||||
window.requestAnimationFrame(update);
|
||||
if (mach.wait_event_timeout > 0) {{
|
||||
mach.wait_event_timer = setTimeout(() => {{
|
||||
window.requestAnimationFrame(update);
|
||||
}},
|
||||
mach.wait_event_timeout * 1000);
|
||||
}}
|
||||
else {{
|
||||
window.requestAnimationFrame(update);
|
||||
}}
|
||||
}};
|
||||
|
||||
mach.update = update;
|
||||
|
||||
window.requestAnimationFrame(update);
|
||||
|
||||
window.addEventListener("mach-close", () => {{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue