Skip to main content

Observe

Observe(name: string): ((protoype: any, memberName: string) => void)

Parameters

name

string

Description

Observe is a property decorator and converts the property into a reactive state. You can detect its status through .subscribe.

Example
import { ReactiveSubscribe, Observe } from "@cfcs/core";

@ReactiveSubscribe
class Component {
// The public name and state name are the same.
@Observe value1 = 1;
// If you want to set public name and private properties separately
@Observe("value2") _value2 = 1;

constructor() {
requestAnimationFrame(() => {
this.value1 = 2;
});
}
}
interface C