@cfcs/core
Version:
Write once, create framework components that supports React, Vue, Svelte, and more.
31 lines (27 loc) • 724 B
TypeScript
/**
* @description `Computed` is a property decorator.
* Changes in computed state values are also recognized according to changes in observers used within the getter function.
* You can detect its status through `.subscribe`.
* @hidden
* @category Reactive-Decorator
* @see ReactiveSubscribe
* @example
* ```ts
const ob1 = observe(0);
const ob2 = observe(1);
// When
@ReactiveSubscribe
class TestComputed {
@Computed
get ob3() {
return ob1.current + ob2.current;
}
}
const inst = new TestComputed();
inst.subscribe("ob3", ob3 => {
console.log(ob3);
});
ob1.current = 1;
```
*/
export declare function Computed(prototype: any, memberName: string, attributes: PropertyDescriptor): PropertyDescriptor;