remove listener on unmount

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-05-24 15:55:37 +01:00
parent 1186207658
commit b9ac1222ed

View file

@ -201,9 +201,7 @@ module.exports = React.createClass({
if (PlatformPeg.get().isElectron()) {
const {ipcRenderer} = require('electron');
ipcRenderer.once('settings', (ev, settings) => {
this.setState({ electron_settings: settings });
});
ipcRenderer.on('settings', this._electronSettings);
ipcRenderer.send('settings_get');
}
@ -226,6 +224,15 @@ module.exports = React.createClass({
if (cli) {
cli.removeListener("RoomMember.membership", this._onInviteStateChange);
}
if (PlatformPeg.get().isElectron()) {
const {ipcRenderer} = require('electron');
ipcRenderer.removeListener('settings', this._electronSettings);
}
},
_electronSettings: function(ev, settings) {
this.setState({ electron_settings: settings });
},
_refreshFromServer: function() {