summaryrefslogtreecommitdiff
path: root/frontend/src/index.ts
blob: a0180738224ca7fc1bf45038dbda7b6f56a6e63f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Sets up DFL, then loads start.ts which starts up the loader
interface Window {
  SP_REACTDOM: any;
}
(async () => {
  if (!window.SP_REACT) {
    console.debug('Setting up React globals...');
    // deliberate partial import
    const DFLWebpack = await import('decky-frontend-lib/dist/webpack');
    // TODO move these finds to dfl in v4
    window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect);
    window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot);
  }
  console.debug('Setting up decky-frontend-lib...');
  window.DFL = await import('decky-frontend-lib');
  await import('./start');
})();