dioxus/packages/interpreter/src/bindings.rs

117 lines
3.1 KiB
Rust
Raw Normal View History

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;
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" {
pub type Interpreter;
#[wasm_bindgen(constructor)]
pub fn new(arg: Element) -> Interpreter;
#[wasm_bindgen(method)]
pub fn SetNode(this: &Interpreter, id: usize, node: Node);
#[wasm_bindgen(method)]
pub fn PushRoot(this: &Interpreter, root: u64);
2022-04-04 16:29:00 +00:00
#[wasm_bindgen(method)]
pub fn PopRoot(this: &Interpreter);
#[wasm_bindgen(method)]
pub fn AppendChildren(this: &Interpreter, many: u32);
#[wasm_bindgen(method)]
pub fn ReplaceWith(this: &Interpreter, root: u64, m: u32);
#[wasm_bindgen(method)]
pub fn InsertAfter(this: &Interpreter, root: u64, n: u32);
#[wasm_bindgen(method)]
pub fn InsertBefore(this: &Interpreter, root: u64, n: u32);
#[wasm_bindgen(method)]
pub fn Remove(this: &Interpreter, root: u64);
#[wasm_bindgen(method)]
pub fn CreateTextNode(this: &Interpreter, text: JsValue, root: u64);
#[wasm_bindgen(method)]
pub fn CreateElement(this: &Interpreter, tag: &str, root: u64);
#[wasm_bindgen(method)]
pub fn CreateElementNs(this: &Interpreter, tag: &str, root: u64, ns: &str);
#[wasm_bindgen(method)]
pub fn CreatePlaceholder(this: &Interpreter, root: u64);
#[wasm_bindgen(method)]
2022-06-22 18:57:05 +00:00
pub fn NewEventListener(
this: &Interpreter,
name: &str,
root: u64,
handler: &Function,
bubbles: bool,
);
#[wasm_bindgen(method)]
2022-06-22 18:57:05 +00:00
pub fn RemoveEventListener(this: &Interpreter, root: u64, name: &str, bubbles: bool);
#[wasm_bindgen(method)]
pub fn SetText(this: &Interpreter, root: u64, text: JsValue);
#[wasm_bindgen(method)]
pub fn SetAttribute(
this: &Interpreter,
root: u64,
field: &str,
value: JsValue,
ns: Option<&str>,
);
#[wasm_bindgen(method)]
2022-02-22 15:14:11 +00:00
pub fn RemoveAttribute(this: &Interpreter, root: u64, field: &str, ns: Option<&str>);
#[wasm_bindgen(method)]
pub fn CreateTemplateRef(this: &Interpreter, id: u64, template_id: u64);
#[wasm_bindgen(method)]
pub fn CreateTemplate(this: &Interpreter, id: u64);
#[wasm_bindgen(method)]
pub fn FinishTemplate(this: &Interpreter, len: u32);
#[wasm_bindgen(method)]
pub fn EnterTemplateRef(this: &Interpreter, id: u64);
#[wasm_bindgen(method)]
pub fn ExitTemplateRef(this: &Interpreter);
#[wasm_bindgen(method)]
pub fn CreateElementTemplate(
this: &Interpreter,
tag: &str,
root: u64,
locally_static: bool,
fully_static: bool,
);
#[wasm_bindgen(method)]
pub fn CreateElementNsTemplate(
this: &Interpreter,
tag: &str,
id: u64,
ns: &str,
locally_static: bool,
fully_static: bool,
);
#[wasm_bindgen(method)]
pub fn CreateTextNodeTemplate(this: &Interpreter, text: &str, root: u64, locally_static: bool);
#[wasm_bindgen(method)]
pub fn CreatePlaceholderTemplate(this: &Interpreter, root: u64);
}