Remove 'focus' event listener when leaving from index.html
This commit is contained in:
@@ -28,9 +28,15 @@ var MainPage = React.createClass({
|
|||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
var thisObj = this;
|
var thisObj = this;
|
||||||
remote.getCurrentWindow().on('focus', function() {
|
var focusListener = function() {
|
||||||
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||||
webview.focus();
|
webview.focus();
|
||||||
|
};
|
||||||
|
|
||||||
|
var currentWindow = remote.getCurrentWindow();
|
||||||
|
currentWindow.on('focus', focusListener);
|
||||||
|
window.addEventListener('beforeunload', function() {
|
||||||
|
currentWindow.removeListener('focus', focusListener);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelect: function(key) {
|
handleSelect: function(key) {
|
||||||
|
Reference in New Issue
Block a user