feat: turn interpreter into crate

This commit is contained in:
Jonathan Kelley 2022-02-01 15:38:48 -05:00
parent 80d792910f
commit ee67a041d2
8 changed files with 19 additions and 6 deletions

View file

@ -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]

View 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]

View file

@ -0,0 +1,6 @@
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=interpreter.ts");
Command::new("tsc").spawn().unwrap();
}

View file

@ -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;

View file

@ -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;

View file

@ -0,0 +1 @@
pub static INTERPRTER_JS: &str = include_str!("../interpreter.js");