Initialise component state in init() instead of constructor

This commit is contained in:
Toby Zerner 2015-10-13 16:58:43 +10:30
parent 41985eb0c3
commit dc6eb4d4ad
4 changed files with 7 additions and 9 deletions

View File

@ -6,9 +6,7 @@ import icon from 'flarum/helpers/icon';
import humanTime from 'flarum/helpers/humanTime';
export default class FlagList extends Component {
constructor(...args) {
super(...args);
init() {
/**
* Whether or not the notifications are loading.
*

View File

@ -2,8 +2,8 @@ import Modal from 'flarum/components/Modal';
import Button from 'flarum/components/Button';
export default class FlagPostModal extends Modal {
constructor(...args) {
super(...args);
init() {
super.init();
this.reason = m.prop('');
this.reasonDetail = m.prop('');

View File

@ -10,8 +10,8 @@ export default class FlagsDropdown extends NotificationsDropdown {
super.initProps(props);
}
constructor(...args) {
super(...args);
init() {
super.init();
this.list = new FlagList();
}

View File

@ -7,8 +7,8 @@ import FlagList from 'flarum/flags/components/FlagList';
* used on mobile devices where the flags dropdown is within the drawer.
*/
export default class FlagsPage extends Page {
constructor(...args) {
super(...args);
init() {
super.init();
app.history.push('flags');