Data storage for sham-ui
npm install sham-ui-data-storage


Data storage for sham-ui
``bash`npm
npm install -D sham-ui-data-storage
`bash`yarn
yarn add sham-ui-data-storage --dev
#### Table of Contents
- StorageGetter
- Parameters
- CreateStorageOptions
- Properties
- createStorage
- Parameters
- Examples
- storage
- Parameters
- useStorage
- Parameters
- Examples
- Storage
- addWatcher
- Parameters
- removeWatcher
- Parameters
- reset
- sync
Getter for storage
Type: Function
#### Parameters
- DI Object
Returns Storage
Options for createStorage
Type: Object
#### Properties
- DI string Registry storage in DI with this key. By default use storage: as key.LIFO
- boolean Use LIFO (last input first output) for storage subscribers. By default falsesync
- boolean Disable async run watchers callback. Callbacks will run only after call sync storage method. By default false
Create a new unique storage object for current DI.
#### Parameters
- fieldsWithDefault Object Fields of storageoptions
- CreateStorageOptions? Extra options for storage (optional, default {})
#### Examples
`javascript`
import createStorage from 'sham-ui-data-storage';
export const { storage, useStorage } = createStorage( {
name: '',
email: '',
sessionValidated: false,
isAuthenticated: false
}, { DI: 'session:storage' } );
Returns {storage: StorageGetter, useStorage: (function ())}
Return storage for DI container
#### Parameters
- DI Object App DI container
Returns Storage
Decorator for component
#### Parameters
- storageAlias string Name of classProperty for access to storage fields
#### Examples
`javascript
{{sessionData.name}}
`
Returns Function
Type: Object
#### addWatcher
Add watcher for field
##### Parameters
- field string Name of fieldcb
- Function Callback
#### removeWatcher
Remove watcher for field
##### Parameters
- field string Name of fieldcb` Function Callback
-
#### reset
Remove all watchers & reset storage field to default values
#### sync
Run all deferred subscribers immediate