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

cordova-plugin-indexeddb2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-indexeddb2

Cordova IndexedDB plugin v2

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

IndexedDB plugin for Apache Cordova

Implements Indexed Database API support for Apache Cordova apps based on IndexedDBShim implementation. This is an upgraded version of the unmaintained Microsoft/cordova-plugin-indexedDB.

IndexedDBShim: v2.2.2

Supports Android, iOS, Windows, and browser.

Sample usage

Plugin follows Indexed Database API specification, no special changes are required. The following sample code creates todo store (if not exist) and adds new record.

var openReq = window.indexedDB.open("sampleDatabase");
openReq.onupgradeneeded = function (event) {
    var db = event.target.result;
    db.createObjectStore("todo", {autoIncrement: true});
};
openReq.onsuccess = function (event) {
    var db = event.target.result,
        sampleItem = {
            todo: "my todo item",
            added_on: new Date()
        };
    var addReq = db.transaction("todo", "readwrite").objectStore("todo").add(sampleItem);
    addReq.onsuccess = function (event) {
        console.log("Operation completed successfully");
    };
    addReq.onerror = function (event) {
        console.log("Operation failed");
    };
}
openReq.onerror = function (event) {
    console.log("Operation failed");
}

Installation Instructions

Plugin is Apache Cordova CLI 3.x compliant.

  1. Make sure an up-to-date version of Node.js is installed, then type the following command to install the Cordova CLI:

     npm install -g cordova
    
  2. Create a project and add the platforms you want to support:

     cordova create sampleApp
     cd sampleApp
     cordova platform add android
     cordova platform add ios
    
  3. Add IndexedDB plugin to your project:

     cordova plugin add cordova-plugin-indexeddb2
     # or
     ionic plugin add cordova-plugin-indexeddb2 --save
    
  4. Build and run, for example:

     cordova build android
     cordova emulate android
    

To learn more, read Apache Cordova CLI Usage Guide.

Keywords

FAQs

Package last updated on 25 Dec 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