Skip to content

This simple JavaScript library makes using Local and Session storage easier. It has no dependencies and is only 2kb minified.

License

Notifications You must be signed in to change notification settings

weedenwright/simple-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

simple-storage

This simple JavaScript library makes using Local and Session storage easier. In addition, while local storage has no expiration, this package has functions that allow you to set an expiration.

It has no dependencies and is only 2kb minified. Web storage is supported in Internet Explorer 8+, Firefox, Opera, Chrome, and Safari.

Available Functions

  • saveLocalStorage(key, content, expiration) - saves to the local storage.
    Parameters
    • key: the unique key for content
    • content: the content to save
    • expiration: (OPTIONAL) if set, the seconds until the storage should expire
  • saveSessionStorage(key, content) - saves to the session storage. Session storage expires with the browser window.
    Parameters
    • key: the unique key for content
    • content: the content to save
  • getLocalStorage(key) - gets an item from local storage
    Parameters
    • key: the unique key to find the content
  • getSessionStorage(key) - gets an item from session storage
    Parameters
    • key: the unique key to find the content
  • deleteLocalStorageValue(key) - removes the content stored for this key
    Parameters
    • key: the unique key to find and remove content for
  • deleteSessionStorageValue(key) - removes the content stored for this key
    Parameters
    • key: the unique key to find and remove content for
  • clearLocalStorage() - clears ALL content in local storage for this domain
  • clearSessionStorage() - clears ALL content in session storage for this domain

About

This simple JavaScript library makes using Local and Session storage easier. It has no dependencies and is only 2kb minified.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published