diff --git a/index.html b/index.html
index 0d1dfea8d..7334bba8a 100644
--- a/index.html
+++ b/index.html
@@ -818,10 +818,12 @@
class HostSelector extends React.PureComponent {
constructor(props) {
super(props);
+
this.state = {
hostName: props.serverAddress,
changed: false
};
+
this.handleHostNameChange = this.handleHostNameChange.bind(this);
this.handleEditingFinished = this.handleEditingFinished.bind(this);
}
@@ -863,6 +865,7 @@
class CheckBox extends React.PureComponent {
constructor(props) {
super(props);
+
this.handleChange = this.handleChange.bind(this);
}
@@ -1175,6 +1178,8 @@
/* BEGIN GroupSubs: a list of group subscribers currently online */
class GroupSubs extends React.Component {
constructor(props) {
+ super(props);
+
this.state = {
onlineSubs: props.subscribers || []
};
@@ -1186,7 +1191,7 @@
render() {
var usersOnline = [];
- this.state.onlineSubs.map(function(sub) {
+ this.state.onlineSubs.map((sub) => {
usersOnline.push(
Tinode Demo Chat
foundContacts: [],
credMethod: ''
};
+
this.handleResize = this.handleResize.bind(this);
this.handleHashRoute = this.handleHashRoute.bind(this);
this.handleOnline = this.handleOnline.bind(this);
@@ -4495,6 +4503,12 @@ Tinode Demo Chat
this.readTimerCallback = null;
}
+ componentWillUnmount() {
+ window.removeEventListener('resize', this.handleResize);
+ window.removeEventListener('hashchange', this.handleHashRoute);
+ document.removeEventListener("visibilitychange", this.handleVisibilityEvent);
+ }
+
// Setup transport (usually websocket) and server address. This will terminate connection with the server.
// FIXME: make static
tnSetup(serverAddress, transport) {
@@ -4630,13 +4644,13 @@ Tinode Demo Chat
var instance = this;
if (promise) {
- promise.then(function(ctrl) {
+ promise.then((ctrl) => {
if (ctrl.code >= 300 && ctrl.text === "validate credentials") {
instance.handleCredentialsRequest(ctrl.params);
} else {
instance.handleLoginSuccessful(instance);
}
- }).catch(function(err) {
+ }).catch((err) => {
// Login failed, report error
instance.setState({loginDisabled: false});
instance.handleError(err.message, "err");