Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handsome-box

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handsome-box

Lightweight data store for web application, and there are only 6 simple api methods for U.Please enjoy it

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

HandsomeBox

Lightweight data store for web application, and there are only 6 simple api methods for U.Please enjoy it

Install

npm install --save handsome-box

Usage

import Store from 'handsome-box';
var t1 = new Store('t1');
var t2 = new Store('t2');
var obj = {};
t1.bind(window).setItem('name', {names: ['jack', 'lilith'], data: {age: 20, money: '10k'}}, {mode: 'sessionStorage', expire: -(Date.now() + 2000)}).setItem('money', 998);
t2.bind(obj).setItem('age', 20).setItem('aaa', 'aaa').removeItem('aaa');
console.log('t1.name', t1.getItem('name'));
console.log('t1.money', t1.getItem('money', true));
console.log('t2.age', t2.getItem('age'));
console.log(t1.list(), t2.list());
t2.clear();
console.log(t2.list());
console.log(obj);

API

bind

bind handsome-box instance to your custom object
params: (obj: Object)

setItem

for saving data
params: (key: String, value: any, option: Object)
option example: {mode: "sessionStorage", expire: Date.now() + 3600}
mode optional value: "cookie" | "sessionStorage" | "localStorage"
expire shold be a timestamp

getItem

for getting data
params: (key: String, isDetail: Boolean)

removeItem

for removing data
params: (key: String)

clear

clear all saved data

list

list all key in one instance

TODO

indexDB and webSQL support

Keywords

FAQs

Package last updated on 07 Mar 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc