@lf-lang/reactor-ts
Version:
A reactor-oriented programming framework in TypeScript
33 lines • 870 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.State = void 0;
/**
* A state variable. This class refines the Read interface by letting `get`
* return T rather than T | Absent. If the state should be nullable or
* uninitialized, this has to be reflected explicitly in T.
*/
class State {
value;
/**
* Create a new state variable and assign it an initial value.
* @param value The initial value to assign to this state variable.
*/
constructor(value) {
this.value = value;
}
/**
* Return the current value of this state variable.
*/
get() {
return this.value;
}
/**
* Set the current value of this state variable.
* @param value
*/
set(value) {
this.value = value;
}
}
exports.State = State;
//# sourceMappingURL=state.js.map