All Projects → veliovgroup → Client-Storage

veliovgroup / Client-Storage

Licence: BSD-3-Clause license
🗄 Bulletproof persistent Client storage, works with disabled Cookies and/or localStorage

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Client-Storage

Meteor-Cookies
🍪 Isomorphic bulletproof cookie functions for client and server
Stars: ✭ 41 (+173.33%)
Mutual labels:  cookie, meteor, meteor-package, cookies
Vue Warehouse
A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js.
Stars: ✭ 161 (+973.33%)
Mutual labels:  cookie, cookies, localstorage
Vue Cookies
A simple Vue.js plugin for handling browser cookies
Stars: ✭ 293 (+1853.33%)
Mutual labels:  cookie, cookies
Ngx Cookie Service
Angular (4.2+ ...11) service for cookies. Originally based on the `ng2-cookies` library.
Stars: ✭ 363 (+2320%)
Mutual labels:  cookie, cookies
Cookie Autodelete
Firefox and Chrome WebExtension that deletes cookies and other browsing site data as soon as the tab closes, domain changes, browser restarts, or a combination of those events.
Stars: ✭ 1,015 (+6666.67%)
Mutual labels:  cookie, cookies
local-storage-fallback
Check and use appropriate storage adapter for browser (localStorage, sessionStorage, cookies, memory)
Stars: ✭ 103 (+586.67%)
Mutual labels:  cookies, localstorage
Cookies.js
Simple cookie framework with full Unicode support
Stars: ✭ 254 (+1593.33%)
Mutual labels:  cookie, cookies
Proxy Storage
Provides an adapter for storage mechanisms (cookies, localStorage, sessionStorage, memoryStorage) and implements the Web Storage interface
Stars: ✭ 10 (-33.33%)
Mutual labels:  cookie, localstorage
CockyGrabber
C# library for the collection of browser information such as cookies, logins, and more
Stars: ✭ 46 (+206.67%)
Mutual labels:  cookie, cookies
blaze-integration
Vue integration with Meteor's Blaze rendering engine.
Stars: ✭ 24 (+60%)
Mutual labels:  meteor, meteor-package
Brownies
🍫 Tastier cookies, local, session, and db storage in a tiny package. Includes subscribe() events for changes.
Stars: ✭ 2,386 (+15806.67%)
Mutual labels:  cookie, localstorage
meteor-computed-field
Reactively computed field for Meteor
Stars: ✭ 18 (+20%)
Mutual labels:  meteor, meteor-package
Zebra Cookie
A ridiculously small (~500 bytes minified) JavaScript API for writing, reading and deleting browser cookies
Stars: ✭ 15 (+0%)
Mutual labels:  cookie, cookies
Angular Local Storage
An AngularJS module that gives you access to the browsers local storage with cookie fallback
Stars: ✭ 2,862 (+18980%)
Mutual labels:  cookie, localstorage
svelte-persistent-store
A Svelte store that keep its value through pages and reloads
Stars: ✭ 111 (+640%)
Mutual labels:  cookie, localstorage
Cookie Universal
Universal cookie plugin, perfect for SSR
Stars: ✭ 376 (+2406.67%)
Mutual labels:  cookie, cookies
contao-cookiebar
Display the information about cookies on your Contao website
Stars: ✭ 27 (+80%)
Mutual labels:  cookie, cookies
nginx cookie flag module
Module for Nginx which allows to set the flags "HttpOnly", "secure" and "SameSite" for cookies.
Stars: ✭ 101 (+573.33%)
Mutual labels:  cookie, cookies
cookie-editor
A powerful browser extension to create, edit and delete cookies
Stars: ✭ 245 (+1533.33%)
Mutual labels:  cookie, cookies
Meteor-Template-helpers
Template helpers for Session, logical operations and debug
Stars: ✭ 35 (+133.33%)
Mutual labels:  meteor, meteor-package

support support

Persistent Browser (Client) Storage

  • 👷 100% Tests coverage;
  • 📦 No external dependencies;
  • 💪 Bulletproof persistent Client storage;
  • ㊗️ With Unicode support for values and keys;
  • 👨‍💻 With String, Array, Object, and Boolean support as values;
  • Works with disabled localStorage and cookies;
  • ☄️ Meteor.js-specific docs
  • 📦 Available via NPM and Atmosphere.

ClientStorage NPM library logo

Install:

npm install --save ClientStorage

Require:

const ClientStorage = require('ClientStorage').ClientStorage;
const clientStorage = new ClientStorage();

ES6 Import:

import { ClientStorage } from 'ClientStorage';
const clientStorage = new ClientStorage();

Usage:

  • clientStorage.get('key') - Read a record. If the key doesn't exist a undefined value will be returned;
    • key - {String} - Record's key;
  • clientStorage.set('key', value[, ttl]) - Create/overwrite a value in storage;
    • key - {String} - Record's key;
    • value - {String|[mix]|Boolean|Object} - Record's value (content);
    • ttl - {Number} — [Optional] Record's TTL in seconds;
  • clientStorage.remove('key') - Remove a record;
    • key - {String} - Record's key;
  • clientStorage.has('key') - Check whether a record exists, returns a boolean value;
    • key - {String} - Record's key;
  • clientStorage.keys() - Returns an array of all storage keys;
  • clientStorage.empty() - Empty storage (remove all key/value pairs). Use with caution! (May remove cookies which weren't set by you).

Storage-specific usage:

By default ClientStorage package handle selecting storage driver in the next order (descending priority):

  1. localStorage
  2. cookies
  3. js (JS Object driven storage)

To alter priority pass "preferred driver" to new ClientStorage(driverName) constructor.

Use cookies only:

Pass cookies as an argument to new instance of ClientStorage:

const { clientStorage } = require('ClientStorage');
const cookiesStorage = new ClientStorage('cookies');
cookiesStorage.has('locale'); // false
cookiesStorage.set('locale', 'en_US'); // true

Use localStorage only:

Pass localStorage as an argument to new instance of ClientStorage:

const { clientStorage } = require('ClientStorage');
const locStorage = new ClientStorage('localStorage');
locStorage.has('locale'); // false
locStorage.set('locale', 'en_US'); // true

Use js only:

Pass js (in-memory js object) as an argument to new instance of ClientStorage:

const { clientStorage } = require('ClientStorage');
const jsStorage = new ClientStorage('js');
jsStorage.has('locale'); // false
jsStorage.set('locale', 'en_US'); // true

Note: All instances are sharing same cookie and localStorage records!

Examples:

const clientStorage = new (require('ClientStorage').ClientStorage);

clientStorage.set('locale', 'en'); // true
clientStorage.set('country', 'usa'); // true
clientStorage.set('gender', 'male'); // true

clientStorage.get('gender'); // male

clientStorage.has('locale'); // true
clientStorage.has('city'); // false

clientStorage.keys(); // ['locale', 'country', 'gender']

clientStorage.remove('locale'); // true
clientStorage.get('locale'); // undefined

clientStorage.keys(); // ['country', 'gender']

clientStorage.empty(); // true
clientStorage.keys(); // []

clientStorage.empty(); // false

Running Tests

Tests are written using Tiny, follow testing instruction in meteor docs

Support this project:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].