Function
Stage-3 decorator that turns a field on a GradumModel into a reactive property
stored in the model's data, rather than on the instance. Use it for state that must be persisted or
synced — on a GradumYModel the value lives in the underlying Y.js structure. Use @signal
instead for state that should stay in memory.
class TodoModel extends GradumModel {
@modelSignal() title = "";
@modelSignal("meta", "author") author = "";
}
Is equivalent to:
class TodoModel extends GradumModel {
@signal get title() { return this.get("title"); }
set title(value) { this.set(value, "title"); }
@signal get author() { return this.get("meta", "author"); }
set author(value) { this.set(value, "meta", "author"); }
}
The key path into the model's data. Defaults to the decorated member name if omitted.