Fix liveview interpreter JS (#1073)
* fix: liveview interpreter js * fix: rustfmt
This commit is contained in:
1 parent
510c242883
commit
0fec47db72
1 file changed
+9
-1
@@ -78,7 +78,13 @@ static INTERPRETER_JS: Lazy<String> = Lazy::new(|| {
|
|||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
interpreter.replace("/*POST_EVENT_SERIALIZATION*/", serialize_file_uploads)
|
let interpreter = interpreter.replace("/*POST_EVENT_SERIALIZATION*/", serialize_file_uploads);
|
||||||
|
interpreter.replace("import { setAttributeInner } from \"./common.js\";", "")
|
||||||
|
});
|
||||||
|
|
||||||
|
static COMMON_JS: Lazy<String> = Lazy::new(|| {
|
||||||
|
let common = dioxus_interpreter_js::COMMON_JS;
|
||||||
|
common.replace("export", "")
|
||||||
});
|
});
|
||||||
|
|
||||||
static MAIN_JS: &str = include_str!("./main.js");
|
static MAIN_JS: &str = include_str!("./main.js");
|
||||||
@@ -89,11 +95,13 @@ static MAIN_JS: &str = include_str!("./main.js");
|
|||||||
/// processing user events and returning edits to the liveview instance
|
/// processing user events and returning edits to the liveview instance
|
||||||
pub fn interpreter_glue(url: &str) -> String {
|
pub fn interpreter_glue(url: &str) -> String {
|
||||||
let js = &*INTERPRETER_JS;
|
let js = &*INTERPRETER_JS;
|
||||||
|
let common = &*COMMON_JS;
|
||||||
format!(
|
format!(
|
||||||
r#"
|
r#"
|
||||||
<script>
|
<script>
|
||||||
var WS_ADDR = "{url}";
|
var WS_ADDR = "{url}";
|
||||||
{js}
|
{js}
|
||||||
|
{common}
|
||||||
{MAIN_JS}
|
{MAIN_JS}
|
||||||
main();
|
main();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in new issue
Block a user