Refactor and fix eval channels (#2302)
* wip * pull out eval into the interpreter * fix web eval * fix DioxusChannel name * properly drop dioxus channel * use typescript dioxus chanel in desktop * add more comments to native eval * add desktop headless eval tests * expand web playwright eval tests * fix web headless tests * fix default hasher path * run eval tests on windows * restore desktop query drop code * remove data from drop desktop query message * catch syntax errors in desktop eval * catch js runtime errors in desktop * fix typo interprerter -> interpreter --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
1d72ef16c4
commit
cbeda0af76
23 files changed
+477
-218
No files matched your search
@@ -26,10 +26,22 @@ fn app() -> Element {
|
||||
let mut eval = eval(
|
||||
r#"
|
||||
window.document.title = 'Hello from Dioxus Eval!';
|
||||
// Receive and multiply 10 numbers
|
||||
for (let i = 0; i < 10; i++) {
|
||||
let value = await dioxus.recv();
|
||||
dioxus.send(value*2);
|
||||
}
|
||||
dioxus.send("returned eval value");
|
||||
"#,
|
||||
);
|
||||
|
||||
// Send 10 numbers
|
||||
for i in 0..10 {
|
||||
eval.send(serde_json::Value::from(i)).unwrap();
|
||||
let value = eval.recv().await.unwrap();
|
||||
assert_eq!(value, serde_json::Value::from(i * 2));
|
||||
}
|
||||
|
||||
let result = eval.recv().await;
|
||||
if let Ok(serde_json::Value::String(string)) = result {
|
||||
eval_result.set(string);
|
||||
|
||||
Reference in new issue
Block a user