summaryrefslogtreecommitdiff
path: root/frontend/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/index.ts')
-rw-r--r--frontend/src/index.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/frontend/src/index.ts b/frontend/src/index.ts
index a108df66..7bb935c7 100644
--- a/frontend/src/index.ts
+++ b/frontend/src/index.ts
@@ -1,12 +1,24 @@
// Sets up DFL, then loads start.ts which starts up the loader
+interface Window {
+ // Shut up TS
+ SP_REACTDOM: any;
+}
+
(async () => {
- console.debug('Setting up @decky/ui...');
+ if (!window.SP_REACT) {
+ console.debug('[Decky:Boot] Setting up React globals...');
+ // deliberate partial import
+ const DFLWebpack = await import('decky-frontend-lib/dist/webpack');
+ window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect);
+ window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot);
+ }
+ console.debug('[Decky:Boot] Setting up @decky/ui...');
window.DFL = await import('@decky/ui');
- console.debug('Authenticating with Decky backend...');
+ console.debug('[Decky:Boot] Authenticating with Decky backend...');
window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text());
- console.debug('Connecting to Decky backend...');
+ console.debug('[Decky:Boot] Connecting to Decky backend...');
window.DeckyBackend = new (await import('./wsrouter')).WSRouter();
await DeckyBackend.connect();
- console.debug('Starting Decky!');
+ console.debug('[Decky:Boot] Starting Decky!');
await import('./start');
})();