From ca75c846b52ad8ab1872e39e588139d19d127b09 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sun, 23 Jul 2023 19:38:46 +0100 Subject: :zap: Dispatching messages now synchronously calls tick and render. --- src/lustre.ffi.mjs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3