This commit is contained in:
Rizky 2023-11-09 04:58:24 +07:00
parent b9f9877daa
commit f0748f4954
3 changed files with 11 additions and 3 deletions

View File

@ -14,6 +14,7 @@ const start = async () => {
let react = {
root: null as null | ReactRoot,
};
(window as any).mobile = registerMobile();
if (
!["localhost", "127.0.0.1", "trycloudflare.com", "ngrok"].find((e) =>

View File

@ -32,9 +32,10 @@ export const initLive = async (p: PG, domain_or_siteid: string) => {
if (p.status === "init") {
p.status = "loading";
w.mobile = registerMobile();
w.mobile.bind(p);
w.mobile.send({ type: "ready" });
if (w.mobile) {
w.mobile.bind(p);
w.mobile.send({ type: "ready" });
}
w.isEditor = false;
w.isLayout = true;

View File

@ -2,12 +2,18 @@ import { FC, useState } from "react";
import { createRoot } from "react-dom/client";
import { GlobalContext, defineReact, defineWindow } from "web-utils";
import { siteLoader } from "./site-loader";
import { registerMobile } from "../live/logic/mobile";
const w = window as unknown as {
prasiContext: any;
rootRender: any;
mobile: any;
};
if (!w.mobile) {
w.mobile = registerMobile();
}
w.prasiContext = {
global: {},
render() {},