UNPKG

reactant-module

Version:

A module model for Reactant

37 lines 657 B
import { Subscribe } from '../interfaces'; /** * ## Description * * You can use `subscribe` to subscribe to state changes in any class module. * * ## Example * * ```ts * @injectable() * class Counter { * constructor() { * subscribe(this, () => { * if (this.count === 3) { * console.log(`new value: ${newValue}`); * } * }); * } * * @state * count = 0; * * @action * increase() { * this.count += 0; * } * } * * const app = testBed({ * modules: [], * main: Counter, * }); * ``` */ declare const subscribe: Subscribe; export { subscribe }; //# sourceMappingURL=subscribe.d.ts.map