diff options
Diffstat (limited to 'packages/main/src/stores/MainStore.ts')
-rw-r--r-- | packages/main/src/stores/MainStore.ts | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/packages/main/src/stores/MainStore.ts b/packages/main/src/stores/MainStore.ts index 7b26c52..eaf5b3c 100644 --- a/packages/main/src/stores/MainStore.ts +++ b/packages/main/src/stores/MainStore.ts | |||
@@ -24,26 +24,32 @@ import { applySnapshot, Instance, types } from 'mobx-state-tree'; | |||
24 | import type { Config } from './Config.js'; | 24 | import type { Config } from './Config.js'; |
25 | import { sharedStore } from './SharedStore'; | 25 | import { sharedStore } from './SharedStore'; |
26 | 26 | ||
27 | export const mainStore = types.model('MainStore', { | 27 | export const mainStore = types |
28 | browserViewBounds: types.optional(types.model('BrowserViewBounds', { | 28 | .model('MainStore', { |
29 | x: 0, | 29 | browserViewBounds: types.optional( |
30 | y: 0, | 30 | types.model('BrowserViewBounds', { |
31 | width: 0, | 31 | x: 0, |
32 | height: 0, | 32 | y: 0, |
33 | }), {}), | 33 | width: 0, |
34 | shared: types.optional(sharedStore, {}), | 34 | height: 0, |
35 | }).views((self) => ({ | 35 | }), |
36 | get config(): Config { | 36 | {}, |
37 | return self.shared.config; | 37 | ), |
38 | }, | 38 | shared: types.optional(sharedStore, {}), |
39 | })).actions((self) => ({ | 39 | }) |
40 | setBrowserViewBounds(bounds: BrowserViewBounds): void { | 40 | .views((self) => ({ |
41 | applySnapshot(self.browserViewBounds, bounds); | 41 | get config(): Config { |
42 | }, | 42 | return self.shared.config; |
43 | setShouldUseDarkColors(shouldUseDarkColors: boolean): void { | 43 | }, |
44 | self.shared.shouldUseDarkColors = shouldUseDarkColors; | 44 | })) |
45 | }, | 45 | .actions((self) => ({ |
46 | })); | 46 | setBrowserViewBounds(bounds: BrowserViewBounds): void { |
47 | applySnapshot(self.browserViewBounds, bounds); | ||
48 | }, | ||
49 | setShouldUseDarkColors(shouldUseDarkColors: boolean): void { | ||
50 | self.shared.shouldUseDarkColors = shouldUseDarkColors; | ||
51 | }, | ||
52 | })); | ||
47 | 53 | ||
48 | export interface MainStore extends Instance<typeof mainStore> {} | 54 | export interface MainStore extends Instance<typeof mainStore> {} |
49 | 55 | ||