Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors

This commit is contained in:
Brandon Millman
2017-12-20 00:44:08 -05:00
committed by Leonid Logvinov
parent 972e1675f6
commit cb11aec84d
93 changed files with 1418 additions and 1345 deletions

View File

@@ -35,8 +35,8 @@ export class LifeCycleRaisedButton extends
backgroundColor: colors.white,
labelColor: colors.darkGrey,
};
private buttonTimeoutId: number;
private didUnmount: boolean;
private _buttonTimeoutId: number;
private _didUnmount: boolean;
constructor(props: LifeCycleRaisedButtonProps) {
super(props);
this.state = {
@@ -44,8 +44,8 @@ export class LifeCycleRaisedButton extends
};
}
public componentWillUnmount() {
clearTimeout(this.buttonTimeoutId);
this.didUnmount = true;
clearTimeout(this._buttonTimeoutId);
this._didUnmount = true;
}
public render() {
if (this.props.isHidden) {
@@ -83,14 +83,14 @@ export class LifeCycleRaisedButton extends
buttonState: ButtonState.LOADING,
});
const didSucceed = await this.props.onClickAsyncFn();
if (this.didUnmount) {
if (this._didUnmount) {
return; // noop since unmount called before async callback returned.
}
if (didSucceed) {
this.setState({
buttonState: ButtonState.COMPLETE,
});
this.buttonTimeoutId = window.setTimeout(() => {
this._buttonTimeoutId = window.setTimeout(() => {
this.setState({
buttonState: ButtonState.READY,
});