diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-23 19:38:46 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-23 19:38:46 +0100 |
commit | ca75c846b52ad8ab1872e39e588139d19d127b09 (patch) | |
tree | 73bf5fb1ce2e86c2ab3e53217ce934f1ab8c52c5 | |
parent | 6696e8300b574df5ea8b9a9c7280c397949f65b7 (diff) | |
download | lustre-ca75c846b52ad8ab1872e39e588139d19d127b09.tar.gz lustre-ca75c846b52ad8ab1872e39e588139d19d127b09.zip |
:zap: Dispatching messages now synchronously calls tick and render.
-rw-r--r-- | src/lustre.ffi.mjs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lustre.ffi.mjs b/src/lustre.ffi.mjs index 9abc107..b99f6e2 100644 --- a/src/lustre.ffi.mjs +++ b/src/lustre.ffi.mjs @@ -13,7 +13,6 @@ export class App { #state = null; #queue = []; #effects = []; - #willUpdate = false; #didUpdate = false; #init = null; @@ -50,10 +49,8 @@ export class App { } dispatch(msg) { - if (!this.#willUpdate) window.requestAnimationFrame(() => this.#tick()); - this.#queue.push(msg); - this.#willUpdate = true; + this.#tick(); } emit(name, event = null) { @@ -71,7 +68,6 @@ export class App { this.#state = null; this.#queue = []; this.#effects = []; - this.#willUpdate = false; this.#didUpdate = false; this.#update = () => {}; this.#view = () => {}; @@ -88,7 +84,6 @@ export class App { this.#flush(); this.#didUpdate && this.#render(); this.#didUpdate = false; - this.#willUpdate = false; } #flush(times = 0) { |