Initialise component state in init() instead of constructor

This allows component state to be overridden via monkey-patch. ref #246
This commit is contained in:
Toby Zerner
2015-10-13 16:55:56 +10:30
parent 2ae7392dea
commit 33dd5fff36
41 changed files with 61 additions and 107 deletions

View File

@ -6,9 +6,7 @@ import Alert from 'flarum/components/Alert';
* be shown and dismissed.
*/
export default class AlertManager extends Component {
constructor(...args) {
super(...args);
init() {
/**
* An array of Alert components which are currently showing.
*

View File

@ -14,9 +14,7 @@ import icon from 'flarum/helpers/icon';
* - `children` A text label to display next to the checkbox.
*/
export default class Checkbox extends Component {
constructor(...args) {
super(...args);
init() {
/**
* Whether or not the checkbox's value is in the process of being saved.
*

View File

@ -9,9 +9,7 @@ import Button from 'flarum/components/Button';
* @abstract
*/
export default class Modal extends Component {
constructor(...args) {
super(...args);
init() {
/**
* An alert component to show below the header.
*

View File

@ -7,9 +7,7 @@ import Modal from 'flarum/components/Modal';
* overwrite the previous one.
*/
export default class ModalManager extends Component {
constructor(...args) {
super(...args);
init() {
this.showing = false;
this.component = null;
}