2021-09-20 05:29:02 +02:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
|
|
|
|
2022-01-19 13:02:58 +01:00
|
|
|
import { TTheme as Theme, ThemeEvents, refreshTheme } from "./Themes/ui/Theme";
|
2021-09-20 05:29:02 +02:00
|
|
|
import { LoadingScreen } from "./ui/LoadingScreen";
|
2021-11-27 21:07:25 +01:00
|
|
|
import { initElectron } from "./Electron";
|
|
|
|
initElectron();
|
2022-01-10 03:11:51 +01:00
|
|
|
globalThis["React"] = React;
|
|
|
|
globalThis["ReactDOM"] = ReactDOM;
|
2021-09-20 05:29:02 +02:00
|
|
|
ReactDOM.render(
|
|
|
|
<Theme>
|
|
|
|
<LoadingScreen />
|
|
|
|
</Theme>,
|
2021-09-25 20:14:50 +02:00
|
|
|
document.getElementById("root"),
|
2021-09-20 05:29:02 +02:00
|
|
|
);
|
2021-09-21 19:08:05 +02:00
|
|
|
|
2021-09-25 07:26:03 +02:00
|
|
|
function rerender(): void {
|
2021-09-22 08:20:29 +02:00
|
|
|
refreshTheme();
|
2021-09-22 07:36:17 +02:00
|
|
|
ReactDOM.render(
|
|
|
|
<Theme>
|
|
|
|
<LoadingScreen />
|
|
|
|
</Theme>,
|
2021-09-25 20:14:50 +02:00
|
|
|
document.getElementById("root"),
|
2021-09-22 07:36:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
ThemeEvents.subscribe(rerender);
|
|
|
|
})();
|
2021-11-27 00:43:50 +01:00
|
|
|
|
|
|
|
(function () {
|
2021-11-27 21:07:25 +01:00
|
|
|
if (process.env.NODE_ENV === "development" || location.href.startsWith("file://")) return;
|
2021-11-27 00:43:50 +01:00
|
|
|
window.onbeforeunload = function () {
|
|
|
|
return "Your work will be lost.";
|
|
|
|
};
|
|
|
|
})();
|
2022-04-25 19:37:24 +02:00
|
|
|
|
|
|
|
(function () {
|
|
|
|
window.print = () => {
|
|
|
|
throw new Error("You accidentally called window.print instead of ns.print");
|
|
|
|
};
|
|
|
|
})();
|