New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-storage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-storage

A Jetpack module for using IndexedDB, based on the localForage API

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
361
decreased by-37.33%
Maintainers
1
Weekly downloads
 
Created
Source

Async Storage for Jetpack Build Status

This is a module for Mozilla's Addon-SDK that simplifies using IndexedDB in Firefox extensions, based on the localForage library.

Installation

The Add-on SDK supports loading modules from a node_modules directory via the jpm tool, so if you're using jpm all you need to do is this:

npm install --save jp-async-storage

If you're using cfx instead ( upgrade! upgrade! ) you can just to this:

cd <extension folder>/lib
wget https://raw.githubusercontent.com/canuckistani/jp-async-storage/master/lib/async-storage.js

Usage

let { AsyncStorage } = require("async-storage");

let config = {
  name: 'my-database',
  version: 1
};
AsyncStorage.open(config, function(e, r) {
  if (e) throw e;
  let item = {_id: 1, string: "Hello world"};
  AsyncStorage.setItem('key-'+item._id, item, function() {
    if (e) throw e;
    // if you got this far, you probably saved data!
  });
}):

Supported API

The localForage api is supported:

  • setItem
  • getItem
  • removeItem
  • getItems
  • keys
  • key
  • length
  • clear

There are two main differences:

  1. Promises are not supported, only callbacks
  2. callback arguments are node-style: the first argument is an error, and the second is hopefully your data.

Tests

First install jpm with npm install jpm -g, then run jpm test -b nightly -v with Firefox Nightly installed.

TODO

  • look into using Promises
  • consider using a Promise-based initialization method like localForage does with a bit more magic.

Keywords

FAQs

Package last updated on 29 Aug 2015

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