From c0042287511c6aaa3447f9ffc38a095add939a25 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Mon, 11 Mar 2024 05:48:53 +0100 Subject: :recycle: Add a 'Map' vdom node for more efficient msg mapping. --- src/client-runtime.ffi.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client-runtime.ffi.mjs') diff --git a/src/client-runtime.ffi.mjs b/src/client-runtime.ffi.mjs index 12c8627..ab80fbf 100644 --- a/src/client-runtime.ffi.mjs +++ b/src/client-runtime.ffi.mjs @@ -71,8 +71,12 @@ export class LustreClientApplication { const vdom = this.#view(this.#model); this.#didUpdate = false; - this.#root = morph(this.#root, vdom, (msg) => { - this.send(new Dispatch(msg)); + this.#root = morph(this.#root, vdom, (handler) => (e) => { + const result = handler(e); + + if (result.isOk()) { + this.send(new Dispatch(result[0])); + } }); } -- cgit v1.2.3