nuxt-storage

๐Ÿ›ข Utilities for easy read and write browser's storage in Nuxt.js project
123,927 128
Install
npm install nuxt-storage
Latest Version:1.2.2
License:MIT
Last Updated:Jun 24, 2021
Links: GitHub  ·  npm
Maintainer: irfan.maulana

๐Ÿ›ข 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

Related Packages

@scayle/storefront-nuxt

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

152,903
nuxt-tsconfig-stub

Stub Nuxt's generated tsconfig.json at installation

70,835 24
kuranuxt

Look at the Nuxt 3 documentation to learn more.

871 0
nuxt-define

One utility function for module authors to define compiler constants for all bui...

13,412,511
dayjs-nuxt

Day.JS Module for Nuxt

1,986,864 126

Version History

Version Released License
1.2.2 MIT
1.2.1 MIT
1.2.0 MIT
1.1.0 MIT
1.0.9 MIT