Skip to content
πŸ›’ Utilities for easy read and write browser's storage in Nuxt.js project
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src chore: fix remove storage May 7, 2019
test fix(linting): eslint standard Mar 21, 2019
.babelrc
.commitlintrc.json chore(lint): add commit-lint and lint-staged Mar 21, 2019
.eslintrc.js chore(deps): update Mar 21, 2019
.gitignore chore(deps): update Mar 21, 2019
.lintstagedrc chore(lint): add commit-lint and lint-staged Mar 21, 2019
.travis.yml Update .travis.yml May 16, 2019
LICENSE Initial commit Sep 25, 2018
README.md Update README.md May 16, 2019
copy.js build: add check directory before copying Apr 22, 2019
jest.config.js fix(linting): eslint standard Mar 21, 2019
nuxt-storage.js fix(linting): eslint standard Mar 21, 2019
package.json Update dependency webpack to v4.32.0 May 20, 2019
renovate.json Create renovate.json May 16, 2019
webpack.config.js fix(linting): eslint standard Mar 21, 2019
yarn.lock Update dependency webpack to v4.32.0 May 20, 2019

README.md

πŸ›’ Nuxt-Storage

License version downloads Travis codecov Dependencies

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
expiry (type: Number) 5
expiryUnit (type: String) m s = second, m = minutes, h = hour, d = day
clear -

Copyright Β© 2018 by Irfan Maulana

You can’t perform that action at this time.