chore: tidy
This commit is contained in:
parent
3ae24411e1
commit
9bc3c2ad12
|
@ -14,8 +14,8 @@ export class Trait extends decorate(class {}) {
|
||||||
const ctor = this.constructor;
|
const ctor = this.constructor;
|
||||||
this._fastDirtyCheck = true;
|
this._fastDirtyCheck = true;
|
||||||
this._memoizedListeners = undefined;
|
this._memoizedListeners = undefined;
|
||||||
this.params = Object.assign({}, ctor.defaultParams(), params);
|
this.params = ctor.defaultParamsWith(params);
|
||||||
this.state = Object.assign({}, ctor.defaultState(), state);
|
this.state = ctor.defaultStateWith(state);
|
||||||
this.previousState = JSON.parse(JSON.stringify(this.state));
|
this.previousState = JSON.parse(JSON.stringify(this.state));
|
||||||
if (this.tick) {
|
if (this.tick) {
|
||||||
this.tick = this.tick.bind(this);
|
this.tick = this.tick.bind(this);
|
||||||
|
@ -53,10 +53,18 @@ export class Trait extends decorate(class {}) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static defaultParamsWith(defaults) {
|
||||||
|
return {...this.defaultParams(), ...defaults};
|
||||||
|
}
|
||||||
|
|
||||||
static defaultState() {
|
static defaultState() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static defaultStateWith(defaults) {
|
||||||
|
return {...this.defaultState(), ...defaults};
|
||||||
|
}
|
||||||
|
|
||||||
static dependencies() {
|
static dependencies() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user