reactant-module
Version:
A module model for Reactant
37 lines • 659 B
TypeScript
import { Watch } from '../interfaces';
/**
* ## Description
*
* You can use `watch` to observe a specific state changes in any class module.
*
* ## Example
*
* ```ts
* @injectable()
* class Counter {
* constructor() {
* watch(this, () => this.count, (newValue) => {
* if (newValue === 3) {
* console.log(`new value: ${newValue}`);
* }
* });
* }
*
* @state
* count = 0;
*
* @action
* increase() {
* this.count += 0;
* }
* }
*
* const app = testBed({
* modules: [],
* main: Counter,
* });
* ```
*/
declare const watch: Watch;
export { watch };
//# sourceMappingURL=watch.d.ts.map