3.0.0 • Published 6 months ago

sham-ui-data-storage v3.0.0

Weekly downloads
34
License
MIT
Repository
-
Last release
6 months ago

sham-ui-data-storage

Build Status npm version MIT Licence

Data storage for sham-ui

Install

# npm
npm install -D sham-ui-data-storage
# yarn
yarn add sham-ui-data-storage --dev

API

Table of Contents

StorageGetter

Getter for storage

Type: Function

Parameters

Returns Storage

CreateStorageOptions

Options for createStorage

Type: Object

Properties

  • DI string Registry storage in DI with this key. By default use storage:<random key> as key.
  • LIFO boolean Use LIFO (last input first output) for storage subscribers. By default false
  • sync boolean Disable async run watchers callback. Callbacks will run only after call sync storage method. By default false

createStorage

Create a new unique storage object for current DI.

Parameters

Examples

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 ())}

storage

Return storage for DI container

Parameters

Returns Storage

useStorage

Decorator for component

Parameters

  • storageAlias string Name of classProperty for access to storage fields

Examples

<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

Storage

Type: Object

addWatcher

Add watcher for field

Parameters

removeWatcher

Remove watcher for field

Parameters

reset

Remove all watchers & reset storage field to default values

sync

Run all deferred subscribers immediate

3.0.0-alpha.7

7 months ago

3.0.0

6 months ago

3.0.0-alpha.6

8 months ago

3.0.0-alpha.5

1 year ago

3.0.0-alpha.4

2 years ago

3.0.0-alpha.1

2 years ago

3.0.0-alpha.3

2 years ago

3.0.0-alpha.2

2 years ago

2.0.0

2 years ago

2.0.0-alpha.11

2 years ago

2.0.0-alpha.10

3 years ago

2.0.0-alpha.9

3 years ago

2.0.0-alpha.8

3 years ago

2.0.0-alpha.7

3 years ago

2.0.0-alpha.6

3 years ago

2.0.0-alpha.4

3 years ago

2.0.0-alpha.5

3 years ago

2.0.0-alpha.0

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago