T
DefinedSettings
What storage.define returns: a schema's settings, bound to one Bucket.
type DefinedSettings = { … }Members
get
(key: string) => SettingValueReads a setting by its dot-separated key; a stored value the schema rejects is logged, removed and read as the default.
reset
() => voidPuts every setting back to its default, leaving other keys of the Bucket alone.
The schema the settings were defined with.
set
(key: string, value: SettingValue) => voidSaves a setting by its dot-separated key; throws when the schema rejects the value.
useSetting
(key: string) => SettingValue | SettingsValuesReact hook that reads a setting, or a section as an object, and re-renders when it changes.
useVersion
(enabled?: boolean) => numberReact hook that re-renders on any change to the settings while enabled, and returns a number that changes with them.
The settings as an object; assign a property, a section's too, to save it.