fix: compile fail for web

This commit is contained in:
Jonathan Kelley 2022-04-04 12:29:00 -04:00
parent 93405c2a40
commit dfc69c0905
3 changed files with 7 additions and 0 deletions

View file

@ -17,6 +17,9 @@ extern "C" {
#[wasm_bindgen(method)]
pub fn PushRoot(this: &Interpreter, root: u64);
#[wasm_bindgen(method)]
pub fn PopRoot(this: &Interpreter);
#[wasm_bindgen(method)]
pub fn AppendChildren(this: &Interpreter, many: u32);

View file

@ -27,6 +27,9 @@ export class Interpreter {
const node = this.nodes[root];
this.stack.push(node);
}
PopRoot() {
this.stack.pop();
}
AppendChildren(many) {
let root = this.stack[this.stack.length - (1 + many)];
let to_add = this.stack.splice(this.stack.length - many);

View file

@ -105,6 +105,7 @@ impl WebsysDom {
for edit in edits.drain(..) {
match edit {
DomEdit::PushRoot { root } => self.interpreter.PushRoot(root),
DomEdit::PopRoot {} => self.interpreter.PopRoot(),
DomEdit::AppendChildren { many } => self.interpreter.AppendChildren(many),
DomEdit::ReplaceWith { root, m } => self.interpreter.ReplaceWith(root, m),
DomEdit::InsertAfter { root, n } => self.interpreter.InsertAfter(root, n),