chore: clean up desktop

This commit is contained in:
Jonathan Kelley committed 2022-12-06 16:37:28 -08:00
1 parent 67a6fa9eb8
commit 1b14b309e9
19 files changed
+305 -298

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ extern "C" {
#[wasm_bindgen(method)]
pub fn MountToRoot(this: &Interpreter);
#[wasm_bindgen(method)]
pub fn AppendChildren(this: &Interpreter, m: u32);
#[wasm_bindgen(method)]
pub fn AssignId(this: &Interpreter, path: &[u8], id: u32);
+10 -2
View File
@@ -210,7 +210,6 @@ export class Interpreter {
}
}
handleEdits(edits) {
for (let template of edits.templates) {
this.SaveTemplate(template);
}
@@ -276,7 +275,16 @@ export class Interpreter {
}
HydrateText(path, value, id) {
let node = this.LoadChild(path);
node.textContent = value;
if (node.nodeType == Node.TEXT_NODE) {
node.textContent = value;
} else {
// replace with a textnode
let text = document.createTextNode(value);
node.replaceWith(text);
node = text;
}
this.nodes[id] = node;
}
ReplacePlaceholder(path, m) {