Merge branch 'master' into jk/suspense-rollover
This commit is contained in:
commit
244ade048e
3 files changed
+16
-14
No files matched your search
@@ -139,8 +139,6 @@ impl VirtualDom {
|
|||||||
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
|
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
|
||||||
let scope = &self.scopes[scope_id.0];
|
let scope = &self.scopes[scope_id.0];
|
||||||
|
|
||||||
log::debug!("Dropping props on scope {:?}", scope_id);
|
|
||||||
|
|
||||||
// make sure we drop all borrowed props manually to guarantee that their drop implementation is called before we
|
// make sure we drop all borrowed props manually to guarantee that their drop implementation is called before we
|
||||||
// run the hooks (which hold an &mut Reference)
|
// run the hooks (which hold an &mut Reference)
|
||||||
// recursively call ensure_drop_safety on all children
|
// recursively call ensure_drop_safety on all children
|
||||||
@@ -153,8 +151,6 @@ impl VirtualDom {
|
|||||||
}
|
}
|
||||||
if let Ok(mut props) = comp.props.try_borrow_mut() {
|
if let Ok(mut props) = comp.props.try_borrow_mut() {
|
||||||
*props = None;
|
*props = None;
|
||||||
} else {
|
|
||||||
log::debug!("cannot drop props for comp {:?}", scope_id);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use serde_json::Value;
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::future::IntoFuture;
|
use std::future::IntoFuture;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
use wry::application::dpi::LogicalSize;
|
||||||
use wry::application::event_loop::ControlFlow;
|
use wry::application::event_loop::ControlFlow;
|
||||||
use wry::application::event_loop::EventLoopProxy;
|
use wry::application::event_loop::EventLoopProxy;
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
@@ -136,6 +137,11 @@ impl DesktopContext {
|
|||||||
let _ = self.proxy.send_event(SetZoomLevel(scale_factor));
|
let _ = self.proxy.send_event(SetZoomLevel(scale_factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// modifies the inner size of the window
|
||||||
|
pub fn set_inner_size(&self, logical_size: LogicalSize<f64>) {
|
||||||
|
let _ = self.proxy.send_event(SetInnerSize(logical_size));
|
||||||
|
}
|
||||||
|
|
||||||
/// launch print modal
|
/// launch print modal
|
||||||
pub fn print(&self) {
|
pub fn print(&self) {
|
||||||
let _ = self.proxy.send_event(Print);
|
let _ = self.proxy.send_event(Print);
|
||||||
@@ -193,6 +199,7 @@ pub enum UserWindowEvent {
|
|||||||
SetDecorations(bool),
|
SetDecorations(bool),
|
||||||
|
|
||||||
SetZoomLevel(f64),
|
SetZoomLevel(f64),
|
||||||
|
SetInnerSize(LogicalSize<f64>),
|
||||||
|
|
||||||
Print,
|
Print,
|
||||||
DevTool,
|
DevTool,
|
||||||
@@ -265,6 +272,7 @@ impl DesktopController {
|
|||||||
SetDecorations(state) => window.set_decorations(state),
|
SetDecorations(state) => window.set_decorations(state),
|
||||||
|
|
||||||
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
|
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
|
||||||
|
SetInnerSize(logical_size) => window.set_inner_size(logical_size),
|
||||||
|
|
||||||
Print => {
|
Print => {
|
||||||
if let Err(e) = webview.print() {
|
if let Err(e) = webview.print() {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
function main() {
|
function main() {
|
||||||
let root = window.document.getElementById("main");
|
let root = window.document.getElementById("main");
|
||||||
|
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
// create a new ipc
|
|
||||||
window.ipc = new IPC(root);
|
window.ipc = new IPC(root);
|
||||||
window.ipc.postMessage(serializeIpcMessage("initialize"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,21 +10,22 @@ class IPC {
|
|||||||
// connect to the websocket
|
// connect to the websocket
|
||||||
window.interpreter = new Interpreter(root);
|
window.interpreter = new Interpreter(root);
|
||||||
|
|
||||||
this.ws = new WebSocket(WS_ADDR);
|
let ws = new WebSocket(WS_ADDR);
|
||||||
|
|
||||||
this.ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.log("Connected to the websocket");
|
ws.send(serializeIpcMessage("initialize"));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ws.onerror = (err) => {
|
ws.onerror = (err) => {
|
||||||
console.error("Error: ", err);
|
// todo: retry the connection
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ws.onmessage = (event) => {
|
ws.onmessage = (event) => {
|
||||||
console.log("Received message: ", event.data);
|
|
||||||
let edits = JSON.parse(event.data);
|
let edits = JSON.parse(event.data);
|
||||||
window.interpreter.handleEdits(edits);
|
window.interpreter.handleEdits(edits);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.ws = ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
postMessage(msg) {
|
postMessage(msg) {
|
||||||
|
|||||||
Reference in new issue
Block a user