Skip to content

cod3gen/nuxt-storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛢 Nuxt-Storage

License version downloads Travis codecov Greenkeeper badge

Utilities for easy read and write browser's storage in Nuxt.js project

Why I need this package?

In Nuxt, it's hard to play with browser's storage like sessionStorage and localStorage. This package will help you handle client side storage with a simple API and with various useful additional features such as expiry.

How to install and use

Install using NPM or Yarn

# NPM
$ npm i nuxt-storage
# Yarn
$ yarn add nuxt-storage

Sample using this package

All API import

import nuxtStorage from 'nuxt-storage';

nuxtStorage.localStorage.setData('key', 'value');
nuxtStorage.sessionStorage.setData('key', 'value');

Partial import

// # for local storage
import { getData, setData } from 'nuxt-storage/local-storage';

// # for session storage
// import { getData, setData } from 'nuxt-storage/session-storage';

setData('key', 'value');

API

Method Name Parameter Default Value Available Options
getData key (type: String) Empty String
setData key (type: String) Empty String
value (type: any) Empty String
expiryInMinutes (type: Number) 5
expiryUnit (type: String) m s = second, m = minutes, h = hour, d = day
clear -

Copyright © 2018 by Irfan Maulana

About

🛢 Utilities for easy read and write browser's storage in Nuxt.js project

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%