Prevent memory leaks in *Model

This commit is contained in:
djmaze 2020-10-25 11:46:58 +01:00
parent 48a9a03762
commit d7a4639d6b
22 changed files with 221 additions and 225 deletions

View file

@ -17,12 +17,14 @@ class ContactPropertyModel extends AbstractModel {
constructor(type = ContactPropertyType.Unknown, typeStr = '', value = '', focused = false, placeholder = '') {
super();
this.type = ko.observable(pInt(type));
this.typeStr = ko.observable(pString(typeStr));
this.focused = ko.observable(!!focused);
this.value = ko.observable(pString(value));
this.addObservables({
type: pInt(type),
typeStr: pString(typeStr),
focused: !!focused,
value: pString(value),
this.placeholder = ko.observable(placeholder);
placeholder: placeholder
});
this.placeholderValue = ko.computed(() => {
const v = this.placeholder();
@ -30,8 +32,6 @@ class ContactPropertyModel extends AbstractModel {
});
this.largeValue = ko.computed(() => ContactPropertyType.Note === this.type());
this.regDisposables([this.placeholderValue, this.largeValue]);
}
toJSON() {