aboutsummaryrefslogtreecommitdiff
path: root/src/lustre.ffi.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2023-07-19 10:48:10 +0100
committerHayleigh Thompson <me@hayleigh.dev>2023-07-19 10:48:10 +0100
commit42067167e278fef921a07addf974f2b278944222 (patch)
treee6b1213995af938eaf2ca0736112acc7d994144a /src/lustre.ffi.mjs
parent7b007a072f39cd69ff4ba16c5f766aa26fab47c9 (diff)
downloadlustre-42067167e278fef921a07addf974f2b278944222.tar.gz
lustre-42067167e278fef921a07addf974f2b278944222.zip
:alembic: Maybe we can just roll our own DOM patching?
Diffstat (limited to 'src/lustre.ffi.mjs')
-rw-r--r--src/lustre.ffi.mjs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lustre.ffi.mjs b/src/lustre.ffi.mjs
index 3a6556e..b57026f 100644
--- a/src/lustre.ffi.mjs
+++ b/src/lustre.ffi.mjs
@@ -1,4 +1,4 @@
-import { morphdom } from "./runtime.ffi.mjs";
+import { morph } from "./runtime.ffi.mjs";
import { Ok, Error } from "./gleam.mjs";
import { map } from "./lustre/element.mjs";
@@ -14,6 +14,10 @@ export class App {
#willUpdate = false;
#didUpdate = false;
+ #init = null;
+ #update = null;
+ #view = null;
+
constructor(init, update, render) {
this.#init = init;
this.#update = update;
@@ -51,7 +55,7 @@ export class App {
const node = this.#view(this.#state);
const vdom = map(node, (msg) => this.dispatch(msg));
- morphdom(this.#root.firstChild, vdom);
+ morph(this.#root, vdom);
}
#tick() {