fix: guarantee text

This commit is contained in:
cha0s 2021-02-12 13:33:07 -06:00
parent 687d9217d6
commit 3769b259ab

View File

@ -1,8 +1,9 @@
import {StateProperty, Trait} from '@avocado/traits';
import {Property} from '@avocado/core';
import {Trait} from '@avocado/traits';
import {compose} from '@latus/core';
const decorate = compose(
StateProperty('text', {
Property('text', {
track: true,
}),
);
@ -23,4 +24,17 @@ export default () => class Textual extends decorate(Trait) {
};
}
async load(json) {
await super.load(json);
this.text = this.state.text;
}
get text() {
return super.text;
}
set text(text) {
super.text = text.toString();
}
};