OptionalDataStore.require()method
Require the data of this store, or throw RequiredError if it is not set.
require(caller: AnyCaller = this.require): T
new OptionalDataStore<T>()
| Return | |
|---|---|
OptionalDataStore<T> | Store a data object that may be undefined (e.g. a document that may not exist). |
| Property | Type | |
|---|---|---|
.data | T | Get the current data of this store, or throw if it is not set. - Supports suspense-like reads: throws a Promise while loading or the error reason on failure (inherited from Store.value). required |
.exists | boolean | Whether the data currently exists (is not undefined). required readonly |
Store a data object that may be undefined (e.g. a document that may not exist).
data or calling require() throws RequiredError when the value is undefined.delete() sets the value back to undefined.Require the data of this store, or throw RequiredError if it is not set.
require(caller: AnyCaller = this.require): T
Update several props in this data.
update(updates: Updates<T>): void
Get a single named prop from this data.
get(name: K): T[K]
Set a single named prop in this data.
set(name: K, value: T[K]): void
Set the data to undefined.
delete(): void