aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/devTools.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/devTools.ts')
-rw-r--r--packages/renderer/src/devTools.ts21
1 files changed, 7 insertions, 14 deletions
diff --git a/packages/renderer/src/devTools.ts b/packages/renderer/src/devTools.ts
index 3ec66aa..3d3ba99 100644
--- a/packages/renderer/src/devTools.ts
+++ b/packages/renderer/src/devTools.ts
@@ -32,31 +32,24 @@ import type { IAnyStateTreeNode } from 'mobx-state-tree';
32 * However, we don't bundle `remotedev` in production, so the call would fail anyways. 32 * However, we don't bundle `remotedev` in production, so the call would fail anyways.
33 * 33 *
34 * @param model The store to connect to the redux devtools. 34 * @param model The store to connect to the redux devtools.
35 * @return A promise that resolves when the store was exposed to the devtools.
35 * @see https://github.com/SocketCluster/socketcluster-client/issues/118#issuecomment-469064682 36 * @see https://github.com/SocketCluster/socketcluster-client/issues/118#issuecomment-469064682
36 */ 37 */
37async function exposeToReduxDevtoolsAsync(model: IAnyStateTreeNode): Promise<void> { 38export async function exposeToReduxDevtools(model: IAnyStateTreeNode): Promise<void> {
38 (window as { global?: unknown }).global = window; 39 (window as { global?: unknown }).global = window;
39 40
41 // Hack to load dev dependencies on demand.
40 const [remotedev, { connectReduxDevtools }] = await Promise.all([ 42 const [remotedev, { connectReduxDevtools }] = await Promise.all([
41 // @ts-ignore 43 // @ts-expect-error `remotedev` has no typings.
42 import('remotedev'), 44 // eslint-disable-next-line import/no-extraneous-dependencies
45 import('remotedev') as unknown,
46 // eslint-disable-next-line import/no-extraneous-dependencies
43 import('mst-middlewares'), 47 import('mst-middlewares'),
44 ]); 48 ]);
45 connectReduxDevtools(remotedev, model); 49 connectReduxDevtools(remotedev, model);
46} 50}
47 51
48/** 52/**
49 * Connects the `model` to the redux devtools extension.
50 *
51 * @param model The store to connect to the redux devtools.
52 */
53export function exposeToReduxDevtools(model: IAnyStateTreeNode): void {
54 exposeToReduxDevtoolsAsync(model).catch((err) => {
55 console.error('Could not connect to Redux devtools', err);
56 });
57}
58
59/**
60 * Sends a message to the main process to reload all services when 53 * Sends a message to the main process to reload all services when
61 * `build/watch.js` sends a reload event on bundle write. 54 * `build/watch.js` sends a reload event on bundle write.
62 */ 55 */