remove listener on unmount
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
1186207658
commit
b9ac1222ed
1 changed files with 10 additions and 3 deletions
|
@ -201,9 +201,7 @@ module.exports = React.createClass({
|
||||||
if (PlatformPeg.get().isElectron()) {
|
if (PlatformPeg.get().isElectron()) {
|
||||||
const {ipcRenderer} = require('electron');
|
const {ipcRenderer} = require('electron');
|
||||||
|
|
||||||
ipcRenderer.once('settings', (ev, settings) => {
|
ipcRenderer.on('settings', this._electronSettings);
|
||||||
this.setState({ electron_settings: settings });
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.send('settings_get');
|
ipcRenderer.send('settings_get');
|
||||||
}
|
}
|
||||||
|
@ -226,6 +224,15 @@ module.exports = React.createClass({
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.removeListener("RoomMember.membership", this._onInviteStateChange);
|
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() {
|
_refreshFromServer: function() {
|
||||||
|
|
Loading…
Reference in a new issue