mach: fundamental changes
- Core doesn't depend to `App` anymore - `setOptions` has replaced with some new functions (`setTitle`, `setSize`, etc) - and more
This commit is contained in:
parent
91a53807ab
commit
1d7cd4be80
26 changed files with 2306 additions and 1999 deletions
|
|
@ -31,21 +31,21 @@
|
|||
let frame = true;
|
||||
let last_update_time = performance.now();
|
||||
let update = function () {
|
||||
if (!frame) return;
|
||||
if (mach.machHasEvent() ||
|
||||
(last_update_time + (mach.wait_event_timeout * 1000)) <= performance.now()) {
|
||||
instance.exports.wasmUpdate();
|
||||
if (!frame) {
|
||||
instance.exports.wasmDeinit();
|
||||
return;
|
||||
}
|
||||
if (mach.machHasEvent() ||
|
||||
last_update_time + mach.wait_timeout * 1000 <= performance.now()) {
|
||||
if (instance.exports.wasmUpdate()) {
|
||||
instance.exports.wasmDeinit();
|
||||
return;
|
||||
}
|
||||
last_update_time = performance.now();
|
||||
}
|
||||
window.requestAnimationFrame(update);
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(update);
|
||||
|
||||
window.addEventListener("mach-close", () => {
|
||||
instance.exports.wasmDeinit();
|
||||
frame = false;
|
||||
});
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue