diff options
author | 2019-02-01 10:35:18 +0100 | |
---|---|---|
committer | 2019-02-01 10:35:18 +0100 | |
commit | da92cd426cbf350313945e3459f96638a79bd44e (patch) | |
tree | 931d18bbf62854366ccf7021d6206de7e0c42636 /src/models/Service.js | |
parent | Update stale.yml (diff) | |
parent | b23 (diff) | |
download | ferdium-app-da92cd426cbf350313945e3459f96638a79bd44e.tar.gz ferdium-app-da92cd426cbf350313945e3459f96638a79bd44e.tar.zst ferdium-app-da92cd426cbf350313945e3459f96638a79bd44e.zip |
Merge branch 'develop'v5.0.0-beta.23
Diffstat (limited to 'src/models/Service.js')
-rw-r--r-- | src/models/Service.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/models/Service.js b/src/models/Service.js index cb66676d4..eee8df8ca 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -114,6 +114,13 @@ export default class Service { | |||
114 | }); | 114 | }); |
115 | } | 115 | } |
116 | 116 | ||
117 | @computed get shareWithWebview() { | ||
118 | return { | ||
119 | spellcheckerLanguage: this.spellcheckerLanguage, | ||
120 | isDarkModeEnabled: this.isDarkModeEnabled, | ||
121 | }; | ||
122 | } | ||
123 | |||
117 | @computed get url() { | 124 | @computed get url() { |
118 | if (this.recipe.hasCustomUrl && this.customUrl) { | 125 | if (this.recipe.hasCustomUrl && this.customUrl) { |
119 | let url; | 126 | let url; |
@@ -162,14 +169,14 @@ export default class Service { | |||
162 | return userAgent; | 169 | return userAgent; |
163 | } | 170 | } |
164 | 171 | ||
165 | initializeWebViewEvents(store) { | 172 | initializeWebViewEvents({ handleIPCMessage, openWindow }) { |
166 | this.webview.addEventListener('ipc-message', e => store.actions.service.handleIPCMessage({ | 173 | this.webview.addEventListener('ipc-message', e => handleIPCMessage({ |
167 | serviceId: this.id, | 174 | serviceId: this.id, |
168 | channel: e.channel, | 175 | channel: e.channel, |
169 | args: e.args, | 176 | args: e.args, |
170 | })); | 177 | })); |
171 | 178 | ||
172 | this.webview.addEventListener('new-window', (event, url, frameName, options) => store.actions.service.openWindow({ | 179 | this.webview.addEventListener('new-window', (event, url, frameName, options) => openWindow({ |
173 | event, | 180 | event, |
174 | url, | 181 | url, |
175 | frameName, | 182 | frameName, |
@@ -182,17 +189,20 @@ export default class Service { | |||
182 | this.isError = false; | 189 | this.isError = false; |
183 | }); | 190 | }); |
184 | 191 | ||
185 | this.webview.addEventListener('did-frame-finish-load', () => { | 192 | const didLoad = () => { |
186 | this.isLoading = false; | 193 | this.isLoading = false; |
187 | 194 | ||
188 | if (!this.isError) { | 195 | if (!this.isError) { |
189 | this.isFirstLoad = false; | 196 | this.isFirstLoad = false; |
190 | } | 197 | } |
191 | }); | 198 | }; |
199 | |||
200 | this.webview.addEventListener('did-frame-finish-load', didLoad.bind(this)); | ||
201 | this.webview.addEventListener('did-navigate', didLoad.bind(this)); | ||
192 | 202 | ||
193 | this.webview.addEventListener('did-fail-load', (event) => { | 203 | this.webview.addEventListener('did-fail-load', (event) => { |
194 | debug('Service failed to load', this.name, event); | 204 | debug('Service failed to load', this.name, event); |
195 | if (event.isMainFrame) { | 205 | if (event.isMainFrame && event.errorCode !== -27 && event.errorCode !== -3) { |
196 | this.isError = true; | 206 | this.isError = true; |
197 | this.errorMessage = event.errorDescription; | 207 | this.errorMessage = event.errorDescription; |
198 | this.isLoading = false; | 208 | this.isLoading = false; |