restore desktop/liveview minification

This commit is contained in:
Evan Almloff committed 2023-10-20 09:18:16 -05:00
1 parent 2404bfeeb3
commit 1d664c616e
6 files changed
+43 -44

No files matched your search

+11 -9
View File
@@ -35,7 +35,7 @@ function handler(event, name, bubbles, config) {
const href = a_element.getAttribute("href");
if (href !== "" && href !== null && href !== undefined) {
window.ipc.postMessage(
serializeIpcMessage("browser_open", { href })
window.interpreter.serializeIpcMessage("browser_open", { href })
);
}
}
@@ -89,7 +89,7 @@ function handler(event, name, bubbles, config) {
if (realId === null) {
return;
}
const message = serializeIpcMessage("user_event", {
const message = window.interpreter.serializeIpcMessage("user_event", {
name: name,
element: parseInt(realId),
data: contents,
@@ -132,7 +132,7 @@ function handler(event, name, bubbles, config) {
return;
}
window.ipc.postMessage(
serializeIpcMessage("user_event", {
window.interpreter.serializeIpcMessage("user_event", {
name: name,
element: parseInt(realId),
data: contents,
@@ -231,11 +231,7 @@ let stack = [];
let root;
const templates = {};
let node, els, end, k;
function initialize(root) {
nodes = [root];
stack = [root];
listeners.root = root;
}
function AppendChildren(id, many) {
root = nodes[id];
els = stack.splice(stack.length - many);
@@ -246,6 +242,12 @@ function AppendChildren(id, many) {
window.interpreter = {}
window.interpreter.initialize = function (root) {
nodes = [root];
stack = [root];
listeners.root = root;
}
window.interpreter.getClientRect = function (id) {
const node = nodes[id];
if (!node) {
@@ -560,7 +562,7 @@ function serialize_event(event) {
}
}
}
function serializeIpcMessage(method, params = {}) {
window.interpreter.serializeIpcMessage = function (method, params = {}) {
return JSON.stringify({ method, params });
}
@@ -363,7 +363,7 @@ pub mod binary_protocol {
// if this is a mounted listener, we send the event immediately
if (event_name === "mounted") {
window.ipc.postMessage(
serializeIpcMessage("user_event", {
window.interpreter.serializeIpcMessage("user_event", {
name: event_name,
element: id,
data: null,