waveterm/src/index.ts

35 lines
944 B
TypeScript
Raw Normal View History

2022-07-12 02:55:03 +02:00
import * as mobx from "mobx";
2022-06-08 02:25:35 +02:00
import * as React from "react";
2023-08-22 06:37:04 +02:00
import { createRoot } from "react-dom/client";
import { sprintf } from "sprintf-js";
import { App } from "./app/app";
import * as DOMPurify from "dompurify";
import { loadFonts } from "./util/util";
2022-06-08 02:25:35 +02:00
2022-07-05 07:37:45 +02:00
// @ts-ignore
let VERSION = __PROMPT_VERSION__;
// @ts-ignore
let BUILD = __PROMPT_BUILD__;
2022-06-08 02:25:35 +02:00
loadFonts();
2022-06-08 02:25:35 +02:00
document.addEventListener("DOMContentLoaded", () => {
let reactElem = React.createElement(App, null, null);
2022-06-20 22:03:20 +02:00
let elem = document.getElementById("app");
2022-06-08 02:25:35 +02:00
let root = createRoot(elem);
let isFontLoaded = document.fonts.check("12px 'JetBrains Mono'");
if (isFontLoaded) {
root.render(reactElem);
} else {
document.fonts.ready.then(() => {
root.render(reactElem);
});
}
2022-06-08 02:25:35 +02:00
});
2022-07-12 02:55:03 +02:00
(window as any).mobx = mobx;
(window as any).sprintf = sprintf;
(window as any).DOMPurify = DOMPurify;
2022-07-12 02:55:03 +02:00
2023-08-22 06:37:04 +02:00
console.log("PROMPT", VERSION, BUILD);