diff options
author | 2019-09-23 20:18:01 +0200 | |
---|---|---|
committer | 2019-09-23 20:18:01 +0200 | |
commit | aa18d3b84ece4fbc864f6a4f4d3b84fbef564b48 (patch) | |
tree | e59f432a96b18626d6fce75f48dd8a8e5f94aafd /src/components/services/content/ServiceWebview.js | |
parent | Add darkreader for universal darkmode (diff) | |
download | ferdium-app-aa18d3b84ece4fbc864f6a4f4d3b84fbef564b48.tar.gz ferdium-app-aa18d3b84ece4fbc864f6a4f4d3b84fbef564b48.tar.zst ferdium-app-aa18d3b84ece4fbc864f6a4f4d3b84fbef564b48.zip |
Fix lint
Diffstat (limited to 'src/components/services/content/ServiceWebview.js')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 7252c695f..75b3d2cf0 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -1,10 +1,13 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { observable, reaction } from 'mobx'; | ||
4 | import ElectronWebView from 'react-electron-web-view'; | 5 | import ElectronWebView from 'react-electron-web-view'; |
5 | 6 | ||
6 | import ServiceModel from '../../../models/Service'; | 7 | import ServiceModel from '../../../models/Service'; |
7 | 8 | ||
9 | const debug = require('debug')('Ferdi:Services'); | ||
10 | |||
8 | @observer | 11 | @observer |
9 | class ServiceWebview extends Component { | 12 | class ServiceWebview extends Component { |
10 | static propTypes = { | 13 | static propTypes = { |
@@ -13,7 +16,22 @@ class ServiceWebview extends Component { | |||
13 | detachService: PropTypes.func.isRequired, | 16 | detachService: PropTypes.func.isRequired, |
14 | }; | 17 | }; |
15 | 18 | ||
16 | webview = null; | 19 | @observable webview = null; |
20 | |||
21 | constructor(props) { | ||
22 | super(props); | ||
23 | |||
24 | reaction( | ||
25 | () => this.webview, | ||
26 | () => { | ||
27 | if (this.webview.view) { | ||
28 | this.webview.view.addEventListener('console-message', (e) => { | ||
29 | debug('Service logged a message:', e.message); | ||
30 | }); | ||
31 | } | ||
32 | }, | ||
33 | ); | ||
34 | } | ||
17 | 35 | ||
18 | componentWillUnmount() { | 36 | componentWillUnmount() { |
19 | const { service, detachService } = this.props; | 37 | const { service, detachService } = this.props; |