refactor(server/utils): isElectron - replace fn with boolean

this values cannot change during runtime,
=> there is no need to have these checks
as dynamic function, instead just
export the boolean value directly
This commit is contained in:
Panagiotis Papadopoulos
2025-01-22 18:57:06 +01:00
parent 94411cf418
commit ca2bb94200
16 changed files with 33 additions and 40 deletions

View File

@@ -53,7 +53,7 @@ async function startTrilium() {
* its startup is slower than focusing the existing process/window. So in the end, it works out without having
* to do a complex evaluation.
*/
if (utils.isElectron()) {
if (utils.isElectron) {
(await import("electron")).app.requestSingleInstanceLock();
}
@@ -71,7 +71,7 @@ async function startTrilium() {
ws.init(httpServer, sessionParser as any); // TODO: Not sure why session parser is incompatible.
if (utils.isElectron()) {
if (utils.isElectron) {
const electronRouting = await import("./routes/electron.js");
electronRouting.default(app);
}
@@ -146,7 +146,7 @@ function startHttpServer() {
}
}
if (utils.isElectron()) {
if (utils.isElectron) {
import("electron").then(({ app, dialog }) => {
// Not all situations require showing an error dialog. When Trilium is already open,
// clicking the shortcut, the software icon, or the taskbar icon, or when creating a new window,