JSPM

stashy

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q17549F
  • License MIT

Quick and Easy Local Cache of almost all JS object types

Package Exports

  • stashy
  • stashy/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stashy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stashy

Stash is a quick and easy local cache of almost all JS object types, it makes it as easy cache file objects as using localstorage The statsh will persist across loads as it is based ontop of the browsers IndexDB The API is simple and similar to firebase's moudlar v9 API

Installation

npm install stashy

Using stashy

Using stashy is simple, you can see an example below

Import cache

import { cache, set } from 'stashy'

Create a refrence to a stash and insert a key value pair

const stashRef = cache()

const key = 'My key'
const value = {firstName: 'Ben', lastName: 'Jerry'}

set(stashRef, key, value)

Get a refrence from a stash

import { get } from 'stashy'

get(stashRef, key).then(value => {
  console.log('My value is:', value)
})

Clear the stash

import { clear } from 'stashy'

clear(stashRef)

License

Released under the terms of the MIT License.