diff options
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r-- | src/stores/AppStore.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 9ad4cd531..3e8b18801 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -12,6 +12,7 @@ import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config'; | |||
12 | import { isMac, isLinux, isWindows } from '../environment'; | 12 | import { isMac, isLinux, isWindows } from '../environment'; |
13 | import locales from '../i18n/translations'; | 13 | import locales from '../i18n/translations'; |
14 | import { gaEvent } from '../lib/analytics'; | 14 | import { gaEvent } from '../lib/analytics'; |
15 | import { onVisibilityChange } from '../helpers/visibility-helper'; | ||
15 | 16 | ||
16 | import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js'; | 17 | import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js'; |
17 | 18 | ||
@@ -56,6 +57,8 @@ export default class AppStore extends Store { | |||
56 | 57 | ||
57 | @observable isFullScreen = mainWindow.isFullScreen(); | 58 | @observable isFullScreen = mainWindow.isFullScreen(); |
58 | 59 | ||
60 | @observable isFocused = true; | ||
61 | |||
59 | constructor(...args) { | 62 | constructor(...args) { |
60 | super(...args); | 63 | super(...args); |
61 | 64 | ||
@@ -163,6 +166,17 @@ export default class AppStore extends Store { | |||
163 | this._healthCheck(); | 166 | this._healthCheck(); |
164 | 167 | ||
165 | this.isSystemDarkModeEnabled = systemPreferences.isDarkMode(); | 168 | this.isSystemDarkModeEnabled = systemPreferences.isDarkMode(); |
169 | |||
170 | onVisibilityChange((isVisible) => { | ||
171 | this.isFocused = isVisible; | ||
172 | // debug('Last focus', moment().diff(this.timeLastFocusStart)); | ||
173 | |||
174 | // if (isVisible) { | ||
175 | // this.timeLastFocusStart = moment(); | ||
176 | // } | ||
177 | |||
178 | debug('Window is visible/focused', isVisible); | ||
179 | }); | ||
166 | } | 180 | } |
167 | 181 | ||
168 | @computed get cacheSize() { | 182 | @computed get cacheSize() { |