reactive-observables
Version:
Framework-agnostic observables and computed properties similar to Knockout and Vue, built on RxJS
14 lines (10 loc) • 473 B
text/typescript
import { registerTrackedPropertyDefinition } from "./tracked-property-definition";
import { getOrSetupComputedProperty } from "./computed-property";
export function computed(proto: any, propertyName: string, descriptor: any) {
registerTrackedPropertyDefinition(proto, propertyName, true);
const getter = descriptor.get;
descriptor.get = function() {
return getOrSetupComputedProperty(this, propertyName, getter).value;
}
return descriptor;
}