aboutsummaryrefslogtreecommitdiff
path: root/src/client-component.ffi.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-02-18 10:45:20 +0000
committerHayleigh Thompson <me@hayleigh.dev>2024-02-18 10:45:20 +0000
commit3b529f3e3881b6d988e38ce32403a3e37ff1b11d (patch)
tree11419d6e7d1019c0ad853278a34b00968601b8f3 /src/client-component.ffi.mjs
parent69b36cf003212e98800d5f27af74bb59f3bbca5d (diff)
downloadlustre-3b529f3e3881b6d988e38ce32403a3e37ff1b11d.tar.gz
lustre-3b529f3e3881b6d988e38ce32403a3e37ff1b11d.zip
:zap: Use 'None' instead of empty dict to avoid bundle bloat.
Diffstat (limited to 'src/client-component.ffi.mjs')
-rw-r--r--src/client-component.ffi.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client-component.ffi.mjs b/src/client-component.ffi.mjs
index c64527f..1a3a7cb 100644
--- a/src/client-component.ffi.mjs
+++ b/src/client-component.ffi.mjs
@@ -16,7 +16,7 @@ export function register({ init, update, view, on_attribute_change }, name) {
window.customElements.define(
name,
- makeComponent(init, update, view, on_attribute_change),
+ makeComponent(init, update, view, on_attribute_change)
);
return new Ok(undefined);
@@ -28,7 +28,7 @@ function makeComponent(init, update, view, on_attribute_change) {
#application = null;
static get observedAttributes() {
- return on_attribute_change.entries().map(([name, _]) => name);
+ return on_attribute_change[0]?.entries().map(([name, _]) => name) ?? [];
}
constructor() {
@@ -47,7 +47,7 @@ function makeComponent(init, update, view, on_attribute_change) {
this.#application
? this.#application.send(new Dispatch(decoded[0]))
: window.requestAnimationFrame(() =>
- this.#application.send(new Dispatch(decoded[0])),
+ this.#application.send(new Dispatch(decoded[0]))
);
}
@@ -66,7 +66,7 @@ function makeComponent(init, update, view, on_attribute_change) {
init(),
update,
view,
- this.#root,
+ this.#root
);
this.appendChild(this.#root);
}