Skip to content

Commit

Permalink
conversion to react 16 seems to be successful
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jul 27, 2018
1 parent a542afd commit 2f8e5c4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions index.html
Expand Up @@ -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);
}
Expand Down Expand Up @@ -863,6 +865,7 @@
class CheckBox extends React.PureComponent {
constructor(props) {
super(props);

this.handleChange = this.handleChange.bind(this);
}

Expand Down Expand Up @@ -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 || []
};
Expand All @@ -1186,7 +1191,7 @@

render() {
var usersOnline = [];
this.state.onlineSubs.map(function(sub) {
this.state.onlineSubs.map((sub) => {
usersOnline.push(
<div className="avatar-box">
<LetterTile
Expand Down Expand Up @@ -1286,6 +1291,7 @@
class CreateAccountView extends React.PureComponent {
constructor(props) {
super(props);

this.state = {
login: '',
password: '',
Expand All @@ -1296,6 +1302,7 @@
errorCleared: false,
saveToken: localStorage.getObject("keep-logged-in")
};

this.handleLoginChange = this.handleLoginChange.bind(this);
this.handlePasswordChange = this.handlePasswordChange.bind(this);
this.handlePassword2Change = this.handlePassword2Change.bind(this);
Expand Down Expand Up @@ -4409,6 +4416,7 @@ <h2>Tinode Demo Chat</h2>
foundContacts: [],
credMethod: ''
};

this.handleResize = this.handleResize.bind(this);
this.handleHashRoute = this.handleHashRoute.bind(this);
this.handleOnline = this.handleOnline.bind(this);
Expand Down Expand Up @@ -4495,6 +4503,12 @@ <h2>Tinode Demo Chat</h2>
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) {
Expand Down Expand Up @@ -4630,13 +4644,13 @@ <h2>Tinode Demo Chat</h2>

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");
Expand Down

0 comments on commit 2f8e5c4

Please sign in to comment.