Move dependency registration to constructor

This commit is contained in:
John Furrow
2016-11-14 21:35:35 -08:00
parent 9863c633d9
commit f9af9e327b
5 changed files with 15 additions and 12 deletions
-2
View File
@@ -37,9 +37,7 @@ class FloodApp extends React.Component {
METHODS_TO_BIND.forEach((method) => {
this[method] = this[method].bind(this);
});
}
componentWillMount() {
UIStore.registerDependency({
id: 'flood-settings',
message: (
+6 -1
View File
@@ -18,7 +18,9 @@ import TrackerFilters from '../Sidebar/TrackerFilters';
import UIStore from '../../stores/UIStore';
class Sidebar extends React.Component {
componentDidMount() {
constructor() {
super();
UIStore.registerDependency({
id: 'torrent-taxonomy',
message: (
@@ -26,6 +28,9 @@ class Sidebar extends React.Component {
defaultMessage="Torrent Taxonomy" />
),
});
}
componentDidMount() {
TorrentStore.listen(EventTypes.CLIENT_TORRENTS_REQUEST_SUCCESS,
this.onTorrentRequestSuccess);
TorrentFilterStore.listen(EventTypes.CLIENT_FETCH_TORRENT_TAXONOMY_SUCCESS,
@@ -83,9 +83,7 @@ class NotificationsButton extends React.Component {
METHODS_TO_BIND.forEach((method) => {
this[method] = this[method].bind(this);
});
}
componentWillMount() {
UIStore.registerDependency({
id: 'notifications',
message: (
@@ -33,9 +33,7 @@ class TransferData extends React.Component {
METHODS_TO_BIND.forEach((method) => {
this[method] = this[method].bind(this);
});
}
componentDidMount() {
UIStore.registerDependency([
{
id: 'transfer-data',
@@ -52,6 +50,9 @@ class TransferData extends React.Component {
)
}
]);
}
componentDidMount() {
this.setState({
sidebarWidth: ReactDOM.findDOMNode(this).offsetWidth
});
@@ -47,7 +47,7 @@ const METHODS_TO_BIND = [
let cachedTorrentList = null;
class TorrentListContainer extends React.Component {
constructor() {
constructor(props) {
super();
this.lastScrollPosition = 0;
@@ -76,13 +76,14 @@ class TorrentListContainer extends React.Component {
this.setScrollPosition = _.throttle(this.setScrollPosition, 250, {
trailing: true
});
UIStore.registerDependency({
id: 'torrent-list',
message: props.intl.formatMessage(MESSAGES.torrentListDependency)
});
}
componentDidMount() {
UIStore.registerDependency({
id: 'torrent-list',
message: this.props.intl.formatMessage(MESSAGES.torrentListDependency)
});
TorrentStore.listen(EventTypes.UI_TORRENT_SELECTION_CHANGE, this.onTorrentSelectionChange);
TorrentStore.listen(EventTypes.CLIENT_TORRENTS_REQUEST_SUCCESS, this.onReceiveTorrentsSuccess);
TorrentStore.listen(EventTypes.UI_TORRENTS_LIST_FILTERED, this.onReceiveTorrentsSuccess);