Added addComputables() to *Model

This commit is contained in:
djmaze 2020-10-25 14:14:14 +01:00
parent 22f606ea75
commit b165a1de4f
6 changed files with 221 additions and 223 deletions

View file

@ -41,6 +41,10 @@ export class AbstractModel {
*/
}
addComputables(obj) {
Object.entries(obj).forEach(([key, fn]) => this[key] = ko.computed(fn) );
}
addSubscribables(obj) {
Object.entries(obj).forEach(([key, fn]) => this.disposables.push( this[key].subscribe(fn) ) );
}