diff options
author | Bennett <hello@vantezzen.io> | 2020-04-18 09:31:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 09:31:59 +0200 |
commit | c579c6bbac7390115970d65109a1d1d4f500d920 (patch) | |
tree | 4b5b449cd3e04fb830ec299b3028fbfe4dc20c97 /src/models | |
parent | Add 5.5.0-gm and 5.5.0 changelog (#574) (diff) | |
download | ferdium-app-c579c6bbac7390115970d65109a1d1d4f500d920.tar.gz ferdium-app-c579c6bbac7390115970d65109a1d1d4f500d920.tar.zst ferdium-app-c579c6bbac7390115970d65109a1d1d4f500d920.zip |
* Add setting to hibernate on startup
* Implement service hibernation on startup
* Fix lint
* Clarify comment
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/Service.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/models/Service.js b/src/models/Service.js index dc8febe0b..2f2b4572d 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -139,6 +139,17 @@ export default class Service { | |||
139 | 139 | ||
140 | this.recipe = recipe; | 140 | this.recipe = recipe; |
141 | 141 | ||
142 | // Check if "Hibernate on Startup" is enabled and hibernate all services except active one | ||
143 | const { | ||
144 | hibernate, | ||
145 | hibernateOnStartup, | ||
146 | } = window.ferdi.stores.settings.app; | ||
147 | // The service store is probably not loaded yet so we need to use localStorage data to get active service | ||
148 | const isActive = window.localStorage.service && JSON.parse(window.localStorage.service).activeService === this.id; | ||
149 | if (hibernate && hibernateOnStartup && !isActive) { | ||
150 | this.isHibernating = true; | ||
151 | } | ||
152 | |||
142 | autorun(() => { | 153 | autorun(() => { |
143 | if (!this.isEnabled) { | 154 | if (!this.isEnabled) { |
144 | this.webview = null; | 155 | this.webview = null; |