Data storage for sham-ui
# npm
npm install -D sham-ui-data-storage
# yarn
yarn add sham-ui-data-storage --dev
Getter for storage
Type: Function
DI
Object
Returns Storage
Options for createStorage
Type: Object
DI
string Registry storage in DI with this key. By default usestorage:<random key>
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 callsync
storage method. By default false
Create a new unique storage object for current DI.
fieldsWithDefault
Object Fields of storageoptions
CreateStorageOptions? Extra options for storage (optional, default{}
)
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
DI
Object App DI container
Returns Storage
Decorator for component
storageAlias
string Name of classProperty for access to storage fields
<template>
<span class="logged-name">
{{sessionData.name}}
</span>
</template>
<script>
import { useStorage } from '../../../storages/session';
function Profile {
}
export default Component( Template, useStorage( ref( 'sessionData' ) ), Profile );
</script>
Returns Function
Type: Object
Add watcher for field
Remove watcher for field
Remove all watchers & reset storage field to default values
Run all deferred subscribers immediate