Construct a wrapper of the 'props', and optionally customise the packing / unpacking behaviour of the wrapper.
the 'props' parameter received by the JSX
option to customise wrapper's packing / unpacking / initialization behaviour for individual properties of the settings.
See PackerUnpackerOption
for more details.
option to customise wrapper's packing / unpacking / initialization behaviour for individual properties of the settings.
See PackerUnpackerOption
for more details.
the 'props' parameter received by the JSX
update all the properties that has been accessed through getToUpdate() to the settingsStorage
Get a typed, readonly copy of the settings. To update the settings, use 'update' method.
Returns a tracked setting object. When accessing a property of the tracked setting object through a key, the key is marked as 'dirty',
meaning it's assumed that the property is changed and needs to be persisted to settingsStorage
later. In the end the commit()
method
of the wrapper needs to be called to persist all the 'dirty' properties.
Persist key & value to settingsStorage, value cannot be ASIS
install a tracker to trackedSettings to track access
Takes a partial settings, then updates the settings and takes care of preserving the updates in settingStorage.
The value of a property of the partial settings can also be the constant ASIS, which is defined in this package. This denotes that the value of the property in the setting object is to be used as is.
a partial SettingsType object
Generated using TypeDoc
A wrapper to make it easier to work with Fitbit Setting API.
Behind the scene, the wrapper 'packs' and 'unpacks' settings into / from strings, and persists to the
props.settingsStorage
, so that users don't need to do that in their codes. By default, 'packs' always usesJSON.stringify()
to encode settings, even if the value is a string, and 'unpacks' always attempts to decode strings withJSON.parse()
and, if that fails, return the strings as is. The packing and unpacking behaviours can be customised.Receives an optional generic type SettingsType, which is the type of the unpacked settings.