fix: compile fail for web

This commit is contained in:
Jonathan Kelley committed 2022-04-04 12:29:00 -04:00
1 parent 93405c2a40
commit dfc69c0905
3 files changed
+7

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ extern "C" {
#[wasm_bindgen(method)] #[wasm_bindgen(method)]
pub fn PushRoot(this: &Interpreter, root: u64); pub fn PushRoot(this: &Interpreter, root: u64);
#[wasm_bindgen(method)]
pub fn PopRoot(this: &Interpreter);
#[wasm_bindgen(method)] #[wasm_bindgen(method)]
pub fn AppendChildren(this: &Interpreter, many: u32); pub fn AppendChildren(this: &Interpreter, many: u32);
+3
View File
@@ -27,6 +27,9 @@ export class Interpreter {
const node = this.nodes[root]; const node = this.nodes[root];
this.stack.push(node); this.stack.push(node);
} }
PopRoot() {
this.stack.pop();
}
AppendChildren(many) { AppendChildren(many) {
let root = this.stack[this.stack.length - (1 + many)]; let root = this.stack[this.stack.length - (1 + many)];
let to_add = this.stack.splice(this.stack.length - many); let to_add = this.stack.splice(this.stack.length - many);
+1
View File
@@ -105,6 +105,7 @@ impl WebsysDom {
for edit in edits.drain(..) { for edit in edits.drain(..) {
match edit { match edit {
DomEdit::PushRoot { root } => self.interpreter.PushRoot(root), DomEdit::PushRoot { root } => self.interpreter.PushRoot(root),
DomEdit::PopRoot {} => self.interpreter.PopRoot(),
DomEdit::AppendChildren { many } => self.interpreter.AppendChildren(many), DomEdit::AppendChildren { many } => self.interpreter.AppendChildren(many),
DomEdit::ReplaceWith { root, m } => self.interpreter.ReplaceWith(root, m), DomEdit::ReplaceWith { root, m } => self.interpreter.ReplaceWith(root, m),
DomEdit::InsertAfter { root, n } => self.interpreter.InsertAfter(root, n), DomEdit::InsertAfter { root, n } => self.interpreter.InsertAfter(root, n),