Skip to content

cutsin/sl-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Fallback Storage

// If browser in private mode, auto fallback to cache
// sessionStorage > memoryStorage
// localStorage > memoryStorage

Usage

import Storage from 'sl-storage'

// LocalStorage
Storage.LS.set('foo', 'bar')
Storage.LS.get('foo', 'bar') // >> bar
Storage.LS.getSet('foo', 'bar') // >> bar
Storage.LS.del('foo')

// SessionStorage
Storage.SS.set('foo', 'bar')
Storage.SS.get('foo', 'bar') // >> bar
Storage.SS.getSet('foo', 'bar') // >> bar
Storage.SS.del('foo')

// Both
Storage.SLS.set('foo', 'oops')
Storage.SLS.get('foo', 'oops') // >> oops
Storage.LS.get('foo', 'oops') // >> oops
Storage.SS.get('foo', 'oops') // >> oops

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published