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) {
|
||||
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
|
||||
// run the hooks (which hold an &mut Reference)
|
||||
// recursively call ensure_drop_safety on all children
|
||||
@@ -153,8 +151,6 @@ impl VirtualDom {
|
||||
}
|
||||
if let Ok(mut props) = comp.props.try_borrow_mut() {
|
||||
*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::IntoFuture;
|
||||
use std::pin::Pin;
|
||||
use wry::application::dpi::LogicalSize;
|
||||
use wry::application::event_loop::ControlFlow;
|
||||
use wry::application::event_loop::EventLoopProxy;
|
||||
#[cfg(target_os = "ios")]
|
||||
@@ -136,6 +137,11 @@ impl DesktopContext {
|
||||
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
|
||||
pub fn print(&self) {
|
||||
let _ = self.proxy.send_event(Print);
|
||||
@@ -193,6 +199,7 @@ pub enum UserWindowEvent {
|
||||
SetDecorations(bool),
|
||||
|
||||
SetZoomLevel(f64),
|
||||
SetInnerSize(LogicalSize<f64>),
|
||||
|
||||
Print,
|
||||
DevTool,
|
||||
@@ -265,6 +272,7 @@ impl DesktopController {
|
||||
SetDecorations(state) => window.set_decorations(state),
|
||||
|
||||
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
|
||||
SetInnerSize(logical_size) => window.set_inner_size(logical_size),
|
||||
|
||||
Print => {
|
||||
if let Err(e) = webview.print() {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
function main() {
|
||||
let root = window.document.getElementById("main");
|
||||
|
||||
if (root != null) {
|
||||
// create a new ipc
|
||||
window.ipc = new IPC(root);
|
||||
window.ipc.postMessage(serializeIpcMessage("initialize"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +10,22 @@ class IPC {
|
||||
// connect to the websocket
|
||||
window.interpreter = new Interpreter(root);
|
||||
|
||||
this.ws = new WebSocket(WS_ADDR);
|
||||
let ws = new WebSocket(WS_ADDR);
|
||||
|
||||
this.ws.onopen = () => {
|
||||
console.log("Connected to the websocket");
|
||||
ws.onopen = () => {
|
||||
ws.send(serializeIpcMessage("initialize"));
|
||||
};
|
||||
|
||||
this.ws.onerror = (err) => {
|
||||
console.error("Error: ", err);
|
||||
ws.onerror = (err) => {
|
||||
// todo: retry the connection
|
||||
};
|
||||
|
||||
this.ws.onmessage = (event) => {
|
||||
console.log("Received message: ", event.data);
|
||||
ws.onmessage = (event) => {
|
||||
let edits = JSON.parse(event.data);
|
||||
window.interpreter.handleEdits(edits);
|
||||
};
|
||||
|
||||
this.ws = ws;
|
||||
}
|
||||
|
||||
postMessage(msg) {
|
||||
|
||||
Reference in new issue
Block a user