knockout-decorators
Advanced tools
Changelog
[0.8.0] - 2017-01-22
subscribe(() => this.observableProp, (value) => { ... })
function@extend
decorator now can be combined with @computed
decorator@subscribe
decorator@reaction
decoratorNative ko.computed
with side effects can be used in all places where we use
@reaction
or @observer
decorator.
In v0.7.1 and earlier @subscribe
decorator can be used only with @observable
but not with @computed
. To avoid this restriction we can create ko.pureComputed
and subscribe to it:
class ViewModel {
@computed get computedProp() { ... }
constructor() {
ko.pureComputed(() => this.computedProp).subscribe((value) => { ... });
}
}
So from v0.8.0 instead of @subscribe
decorator there is shorthand function subscribe
with some extra functionality like "subscribe once":
class ViewModel {
@computed get computedProp() { ... }
constructor() {
subscribe(() => this.computedProp, (value) => { ... });
}
}
Changelog
[0.5.0] - 2016-12-10
Changelog
[0.4.2] - 2016-10-05
@observable
decorator@observableArray
decorator@computed
decorator@observer
decorator@extend
decorator@subscribe
decorator@component
decorator