Merge pull request #243 from asaaki/update/wry-0-13

Update to wry 0.13; support IPC, devtool, and feature flags
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2022-02-15 11:23:16 -05:00
commit 345dfd4214
11 files changed
+357 -354

No files matched your search

+8 -4
View File
@@ -2,7 +2,7 @@ export function main() {
let root = window.document.getElementById("main");
if (root != null) {
window.interpreter = new Interpreter(root);
window.rpc.call("initialize");
window.ipc.postMessage(serializeIpcMessage("initialize"))
}
}
export class Interpreter {
@@ -207,7 +207,7 @@ export class Interpreter {
event.preventDefault();
const href = target.getAttribute("href");
if (href !== "" && href !== null && href !== undefined) {
window.rpc.call("browser_open", { href });
window.ipc.postMessage(serializeIpcMessage("browser_open", { href }))
}
}
}
@@ -261,11 +261,12 @@ export class Interpreter {
if (realId == null) {
return;
}
window.rpc.call("user_event", {
window.ipc.postMessage(serializeIpcMessage(
"user_event", {
event: edit.event_name,
mounted_dom_id: parseInt(realId),
contents: contents,
});
}));
}
};
this.NewEventListener(edit.event_name, edit.root, handler);
@@ -544,6 +545,9 @@ export function serialize_event(event) {
}
}
}
function serializeIpcMessage(method, params = {}) {
return JSON.stringify({ method, params });
}
const bool_attrs = {
allowfullscreen: true,
allowpaymentrequest: true,
+1 -1
View File
@@ -1,4 +1,4 @@
pub static INTERPRTER_JS: &str = include_str!("./interpreter.js");
pub static INTERPRETER_JS: &str = include_str!("./interpreter.js");
#[cfg(feature = "web")]
mod bindings;