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-12-07 21:11:40 +00:00
|
|
|
use web_sys::Element;
|
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-12-06 00:47:04 +00:00
|
|
|
pub fn SaveTemplate(this: &Interpreter, template: JsValue);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-12-01 05:46:15 +00:00
|
|
|
pub fn MountToRoot(this: &Interpreter);
|
2022-04-04 16:29:00 +00:00
|
|
|
|
2022-12-07 00:37:28 +00:00
|
|
|
#[wasm_bindgen(method)]
|
2022-12-07 21:11:40 +00:00
|
|
|
pub fn AppendChildren(this: &Interpreter, m: u32, id: u32);
|
2022-12-07 00:37:28 +00:00
|
|
|
|
2022-02-01 20:54:32 +00:00
|
|
|
#[wasm_bindgen(method)]
|
2022-12-01 05:46:15 +00:00
|
|
|
pub fn AssignId(this: &Interpreter, path: &[u8], id: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn CreatePlaceholder(this: &Interpreter, id: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn CreateTextNode(this: &Interpreter, value: JsValue, id: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn HydrateText(this: &Interpreter, path: &[u8], value: &str, id: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn LoadTemplate(this: &Interpreter, name: &str, index: u32, id: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn ReplaceWith(this: &Interpreter, id: u32, m: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn ReplacePlaceholder(this: &Interpreter, path: &[u8], m: u32);
|
2022-02-01 20:54:32 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn InsertAfter(this: &Interpreter, id: u32, n: u32);
|
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
|
|
|
pub fn InsertBefore(this: &Interpreter, id: u32, n: u32);
|
|
|
|
|
2022-02-01 20:54:32 +00:00
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn SetAttribute(this: &Interpreter, id: u32, name: &str, value: JsValue, ns: Option<&str>);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn SetBoolAttribute(this: &Interpreter, id: u32, name: &str, value: bool);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn SetText(this: &Interpreter, id: u32, text: JsValue);
|
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
|
|
|
pub fn NewEventListener(
|
|
|
|
this: &Interpreter,
|
|
|
|
name: &str,
|
|
|
|
id: u32,
|
|
|
|
bubbles: bool,
|
2022-12-06 00:47:04 +00:00
|
|
|
handler: &Function,
|
2022-11-30 22:21:10 +00:00
|
|
|
);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn RemoveEventListener(this: &Interpreter, name: &str, id: u32);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn RemoveAttribute(this: &Interpreter, id: u32, field: &str, ns: Option<&str>);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn Remove(this: &Interpreter, id: u32);
|
2022-09-30 19:03:06 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
2022-11-30 22:21:10 +00:00
|
|
|
pub fn PushRoot(this: &Interpreter, id: u32);
|
2022-12-06 20:24:35 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen(method)]
|
|
|
|
pub fn AppendChildren(this: &Interpreter, id: u32, m: u32);
|
2022-02-01 20:44:08 +00:00
|
|
|
}
|