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