Webview: bootstrap layout
This commit is contained in:
@@ -3,7 +3,7 @@ import { render } from "solid-js/web";
|
||||
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
|
||||
import { getFakeResponse } from "../mock";
|
||||
const root = document.getElementById("app");
|
||||
|
||||
window.clan = window.clan || {};
|
||||
@@ -14,5 +14,26 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
|
||||
);
|
||||
}
|
||||
|
||||
console.log(import.meta.env);
|
||||
if (import.meta.env.DEV) {
|
||||
console.log("Development mode");
|
||||
window.webkit = window.webkit || {
|
||||
messageHandlers: {
|
||||
gtk: {
|
||||
postMessage: (postMessage) => {
|
||||
const { method, data } = postMessage;
|
||||
console.debug("Python API call", { method, data });
|
||||
setTimeout(() => {
|
||||
const mock = getFakeResponse(method, data);
|
||||
console.log("mock", { mock });
|
||||
|
||||
window.clan[method](JSON.stringify(mock));
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
render(() => <App />, root!);
|
||||
|
||||
Reference in New Issue
Block a user