2022-02-11 02:00:15 +00:00
|
|
|
#![allow(clippy::unused_unit, non_upper_case_globals)]
|
|
|
|
|
2022-02-04 06:56:54 +00:00
|
|
|
use js_sys::Function;
|
2022-02-01 20:54:32 +00:00
|
|
|
use wasm_bindgen::prelude::*;
|
2022-02-04 06:56:54 +00:00
|
|
|
use web_sys::{Element, Node};
|
2022-02-01 20:57:07 +00:00
|
|
|
|
2022-02-04 06:56:54 +00:00
|
|
|
#[wasm_bindgen(module = "/src/interpreter.js")]
|
|
|
|
extern "C" {
|
2022-02-01 20:54:32 +00:00
|
|
|
pub type Interpreter;
|
|
|
|
|
|
|
|
#[wasm_bindgen(constructor)]
|
|
|
|
pub fn new(arg: Element) -> Interpreter;
|
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-03-17 14:51:23 +00:00
|
|
|
pub fn SetNode(this: &Interpreter, id: usize, node: Node);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn AppendChildren(this: &Interpreter, root: Option<u64>, children: Vec<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
2022-04-04 16:29:00 +00:00
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn ReplaceWith(this: &Interpreter, root: Option<u64>, nodes: Vec<u64>);
|
2022-04-04 16:29:00 +00:00
|
|
|
|
2022-02-01 20:54:32 +00:00
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn InsertAfter(this: &Interpreter, root: Option<u64>, nodes: Vec<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn InsertBefore(this: &Interpreter, root: Option<u64>, nodes: Vec<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn Remove(this: &Interpreter, root: Option<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CreateTextNode(this: &Interpreter, text: JsValue, root: Option<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CreateElement(this: &Interpreter, tag: &str, root: Option<u64>, children: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CreateElementNs(
|
|
|
|
this: &Interpreter,
|
|
|
|
tag: &str,
|
|
|
|
root: Option<u64>,
|
|
|
|
ns: &str,
|
|
|
|
children: u32,
|
|
|
|
);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CreatePlaceholder(this: &Interpreter, root: Option<u64>);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-06-22 18:57:05 +00:00
|
|
|
pub fn NewEventListener(
|
|
|
|
this: &Interpreter,
|
|
|
|
name: &str,
|
2022-10-18 21:42:45 +00:00
|
|
|
root: Option<u64>,
|
2022-06-22 18:57:05 +00:00
|
|
|
handler: &Function,
|
|
|
|
bubbles: bool,
|
|
|
|
);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn RemoveEventListener(this: &Interpreter, root: Option<u64>, name: &str, bubbles: bool);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn SetText(this: &Interpreter, root: Option<u64>, text: JsValue);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-02-07 15:17:16 +00:00
|
|
|
pub fn SetAttribute(
|
|
|
|
this: &Interpreter,
|
2022-10-18 21:42:45 +00:00
|
|
|
root: Option<u64>,
|
2022-02-07 15:17:16 +00:00
|
|
|
field: &str,
|
|
|
|
value: JsValue,
|
|
|
|
ns: Option<&str>,
|
|
|
|
);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn RemoveAttribute(this: &Interpreter, root: Option<u64>, field: &str, ns: Option<&str>);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CloneNode(this: &Interpreter, root: Option<u64>, new_id: u64);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn CloneNodeChildren(this: &Interpreter, root: Option<u64>, new_ids: Vec<u64>);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn FirstChild(this: &Interpreter);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn NextSibling(this: &Interpreter);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn ParentNode(this: &Interpreter);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn StoreWithId(this: &Interpreter, id: u64);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-10-18 21:42:45 +00:00
|
|
|
pub fn SetLastNode(this: &Interpreter, id: u64);
|
2022-02-01 20:44:08 +00:00
|
|
|
}
|