move ScopeId methods to the runtime (#4723)
* move `ScopeId` methods to runtime methods * cargo check unused * wip... * wip... * fix consume context * fix test * guard hoisted * fix doc comment
This commit is contained in:
1 parent
c56bac04f4
commit
c29cef4ea3
40 files changed
+466
-697
No files matched your search
@@ -60,37 +60,31 @@ pub fn launch_virtual_dom_blocking(virtual_dom: VirtualDom, mut desktop_config:
|
||||
// Windows-only drag-n-drop fix events. We need to call the interpreter drag-n-drop code.
|
||||
UserWindowEvent::WindowsDragDrop(id) => {
|
||||
if let Some(webview) = app.webviews.get(&id) {
|
||||
webview.dom.in_runtime(|| {
|
||||
ScopeId::ROOT.in_runtime(|| {
|
||||
eval("window.interpreter.handleWindowsDragDrop();");
|
||||
});
|
||||
webview.dom.in_scope(ScopeId::ROOT, || {
|
||||
eval("window.interpreter.handleWindowsDragDrop();");
|
||||
});
|
||||
}
|
||||
}
|
||||
UserWindowEvent::WindowsDragLeave(id) => {
|
||||
if let Some(webview) = app.webviews.get(&id) {
|
||||
webview.dom.in_runtime(|| {
|
||||
ScopeId::ROOT.in_runtime(|| {
|
||||
eval("window.interpreter.handleWindowsDragLeave();");
|
||||
});
|
||||
webview.dom.in_scope(ScopeId::ROOT, || {
|
||||
eval("window.interpreter.handleWindowsDragLeave();");
|
||||
});
|
||||
}
|
||||
}
|
||||
UserWindowEvent::WindowsDragOver(id, x_pos, y_pos) => {
|
||||
if let Some(webview) = app.webviews.get(&id) {
|
||||
webview.dom.in_runtime(|| {
|
||||
ScopeId::ROOT.in_runtime(|| {
|
||||
let e = eval(
|
||||
r#"
|
||||
webview.dom.in_scope(ScopeId::ROOT, || {
|
||||
let e = eval(
|
||||
r#"
|
||||
const xPos = await dioxus.recv();
|
||||
const yPos = await dioxus.recv();
|
||||
window.interpreter.handleWindowsDragOver(xPos, yPos)
|
||||
"#,
|
||||
);
|
||||
);
|
||||
|
||||
_ = e.send(x_pos);
|
||||
_ = e.send(y_pos);
|
||||
});
|
||||
_ = e.send(x_pos);
|
||||
_ = e.send(y_pos);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user