🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

veams-utility-storage

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

veams-utility-storage

Offers a simple API for storing Javascript objects in HTML5 web storage using distinct namespaces.

latest
Source
npmnpm
Version
5.1.0
Version published
Weekly downloads
6
Maintainers
2
Weekly downloads
 
Created
Source

npm version Gitter Chat

Storage

Description

This utility offers a simple API for storing Javascript objects in HTML5 web storage using distinct namespaces

Requirements

  • Veams >= v5.0.0 - Veams Framework
  • babel-preset-stage-0 - Babel preset for stage 0 plugins.

Installation

Installation with Veams

veams install vu storage

Usage (API)

Just initialize on demand like this:

let myStorage = new Storage({
	type: 'permanent', // or 'session'
	name: 'someName' // custom namespace (e.g. from module)
});

Constructor

Storage(opts: StorageOptions)

/**
 * Constructor
 *
 * @param {Object} opts - options which will be passed as object
 * @param {String} opts.type - storage type ('permanent' || 'session')
 * @param {String} opts.name - namespace in which items will be saved
 */
 
 

Properties

  • length {Number} - item count

Methods

setItem(name:String, obj:Object)

/**
 * Set item
 *
 * @param {String} name - item name
 * @param {Object} obj - object to save
 */

getItem (name:String)

/**
 * Get item by name
 *
 * @param {String} name - item name
 * @return {Object} - object retrieved by item name
 */

getAllItems ()

/**
 * Get all items
 *
 * @public
 *
 * @return {Object} - object containing all items
 */

removeItem (name:String)

/**
 * Remove item by name
 *
 * @param {String} name - item name
 */

clear ()

/**
 * Clear all items
 */

Keywords

veams

FAQs

Package last updated on 02 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts