mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
feat: turn interpreter into crate
This commit is contained in:
parent
80d792910f
commit
ee67a041d2
8 changed files with 19 additions and 6 deletions
|
@ -22,6 +22,7 @@ dioxus-ssr = { path = "./packages/ssr", version = "^0.1.3", optional = true }
|
|||
|
||||
dioxus-router = { path = "./packages/router", version = "^0.1.1", optional = true }
|
||||
dioxus-mobile = { path = "./packages/mobile", version = "^0.0.3", optional = true }
|
||||
dioxus-interpreter-js = { path = "./packages/interpreter", version = "^0.0.0", optional = true }
|
||||
# dioxus-liveview = { path = "./packages/liveview", optional = true }
|
||||
|
||||
[features]
|
||||
|
@ -52,6 +53,7 @@ members = [
|
|||
"packages/ssr",
|
||||
"packages/desktop",
|
||||
"packages/mobile",
|
||||
"packages/interpreter",
|
||||
]
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
8
packages/interpreter/Cargo.toml
Normal file
8
packages/interpreter/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "dioxus-interpreter-js"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
6
packages/interpreter/build.rs
Normal file
6
packages/interpreter/build.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=interpreter.ts");
|
||||
Command::new("tsc").spawn().unwrap();
|
||||
}
|
|
@ -198,7 +198,7 @@ export class Interpreter {
|
|||
this.RemoveEventListener(edit.root, edit.event_name);
|
||||
break;
|
||||
case "NewEventListener":
|
||||
// this handler is only provided on desktop implementations since this
|
||||
// this handler is only provided on desktop implementations since this
|
||||
// method is not used by the web implementation
|
||||
let handler = (event) => {
|
||||
let target = event.target;
|
|
@ -1,7 +1,3 @@
|
|||
|
||||
|
||||
|
||||
|
||||
export function main() {
|
||||
let root = window.document.getElementById("main");
|
||||
if (root != null) {
|
||||
|
@ -245,7 +241,7 @@ export class Interpreter {
|
|||
case "NewEventListener":
|
||||
|
||||
|
||||
// this handler is only provided on desktop implementations since this
|
||||
// this handler is only provided on desktop implementations since this
|
||||
// method is not used by the web implementation
|
||||
let handler = (event: Event) => {
|
||||
let target = event.target as Element | null;
|
1
packages/interpreter/src/lib.rs
Normal file
1
packages/interpreter/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub static INTERPRTER_JS: &str = include_str!("../interpreter.js");
|
Loading…
Reference in a new issue