Optimize constructors

This commit is contained in:
Felix Linker
2020-12-29 16:39:18 +01:00
parent 436e626c42
commit 20e448fc0a
4 changed files with 5 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ import { MountFixed, MountGimballed, MountTurret } from './SvgIcons';
import FuzzySearch from 'react-fuzzy';
import { getModuleInfo } from 'ed-forge/lib/data/items';
import { groupBy, mapValues, sortBy } from 'lodash';
import autoBind from 'auto-bind';
const PRESS_THRESHOLD = 500; // mouse/touch down threshold
@@ -36,8 +37,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
*/
constructor(props, context) {
super(props);
this._hideDiff = this._hideDiff.bind(this);
this._showSearch = this._showSearch.bind(this);
autoBind(this);
this.state = this._initState(props, context);
}

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import ContainerDimensions from 'react-container-dimensions';
import * as d3 from 'd3';
import TranslatedComponent from './TranslatedComponent';
import autoBind from 'auto-bind';
const MARGIN = { top: 15, right: 20, bottom: 35, left: 60 };
@@ -44,13 +45,7 @@ export default class LineChart extends TranslatedComponent {
*/
constructor(props, context) {
super(props);
this._updateDimensions = this._updateDimensions.bind(this);
this._updateSeries = this._updateSeries.bind(this);
this._tooltip = this._tooltip.bind(this);
this._showTip = this._showTip.bind(this);
this._hideTip = this._hideTip.bind(this);
this._moveTip = this._moveTip.bind(this);
autoBind(this);
const series = props.series;

View File

@@ -11,14 +11,6 @@ export default class ModalHelp extends TranslatedComponent {
title: PropTypes.string
};
/**
* Constructor
* @param {Object} props React Component properties
*/
constructor(props) {
super(props);
}
/**
* Render the modal
* @return {React.Component} Modal Content

View File

@@ -27,7 +27,7 @@ export default class ShipPicker extends TranslatedComponent {
* @param {object} props Properties react
* @param {object} context react context
*/
constructor(props, context) { // eslint-disable-line
constructor(props, context) {
super(props);
autoBind(this);
this.state = { menuOpen: false };