From 25649e77da0e006e0290b9912a2c1ae639158212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 6 Sep 2022 10:48:23 +0200 Subject: [PATCH 1/2] Add a global flag to test for execution within electron --- src/browser/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/browser/index.tsx b/src/browser/index.tsx index 233b61d1..0bb7e084 100644 --- a/src/browser/index.tsx +++ b/src/browser/index.tsx @@ -44,4 +44,7 @@ function main(): void { ); } +// Flag to test for Electron integration +window.isElectron = true; + window.onload = main; From 928207ed993836926bca0a804b9bf66a11174082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Wed, 7 Sep 2022 12:21:51 +0200 Subject: [PATCH 2/2] Add type declaration Co-authored-by: Mehmet Bektas <40003442+mbektas@users.noreply.github.com> --- src/browser/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/browser/index.tsx b/src/browser/index.tsx index 0bb7e084..037de811 100644 --- a/src/browser/index.tsx +++ b/src/browser/index.tsx @@ -43,6 +43,12 @@ function main(): void { document.getElementById('root') ); } +declare global { + // eslint-disable-next-line @typescript-eslint/naming-convention + interface Window { + isElectron?: boolean; + } +} // Flag to test for Electron integration window.isElectron = true;