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

localforage-memoryStorageDriver

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

localforage-memoryStorageDriver

A volatile, in memory storage driver for localForage.

  • 0.9.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7K
decreased by-61.52%
Maintainers
1
Weekly downloads
 
Created
Source

localforage-memoryStorageDriver

npm

A volatile, in memory storage driver for localForage.

The stored data are lost after a page reload. Originally designed for unit-testing (especially SPAs) and as a fallback for environmets without any storage APIs.

This driver serializes the stored items, so that

  • it works consistently compared to the "native" localForage driver
  • modifications of retrieved (complex) objects do not affect the stored items.

Requirements

Installation

npm i localforage-memoryStorageDriver

Example

localforage.defineDriver(memoryStorageDriver).then(function() {
  return localforage.setDriver(memoryStorageDriver._driver);
}).then(function() {
  console.log('Active driver: ' + localforage.driver());
  return localforage.setItem('test1', 'value1');
}).then(function() {
  console.log('setItem(\'test1\', \'value1\')');
  return localforage.getItem('test1');
}).then(function(value) {
  console.log('getItem(\'test1\') => ' + value);
  return localforage.clear();
})

Keywords

FAQs

Package last updated on 10 May 2016

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