npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-indexeddb-async

v2.2.1

Published

An asynchronous IndexedDB plug-in for Cordova apps

Downloads

89

Readme

Asynchronous IndexedDB plugin for Cordova

Dependencies npm License

Features

Installation

Install via the Cordova CLI.

For Cordova CLI 4.x, use the GIT URL syntax:

cordova plugin add https://github.com/ABB-Austin/cordova-plugin-indexeddb-async.git

For Cordova CLI 5.x, use the new npm syntax:

cordova plugin add cordova-plugin-indexeddb-async

Using the Plugin

Cordova will automatically load the plugin and run it. So all you need to do is use IndexedDB just like normal.

Here's an example

Supported Platforms

This plugin supports ios, android, and windows (phone and desktop), as well as the new browser platform.

Android

Android 4.3 and earlier do not support IndexedDB, so this plugin will automatically add IndexedDB support. On Android 4.4 and later, the plugin does nothing, since IndexedDB is already natively supported.

Browser

All modern browsers natively support IndexedDB, so the plugin won't do anything. But for older browsers that support WebSQL, this plugin will automatically add IndexedDB support.

iOS

iOS 7 and earlier do not support IndexedDB, so this plugin will automatically add IndexedDB support. On iOS 8 and later, the plugin does nothing, since IndexedDB is already natively supported.

iOS 8's implementation of IndexedDB is very buggy. So, you may want to use this plugin rather than the native implementation. To do that, add the following line of code to your app:

window.shimIndexedDB.__useShim()
Known Issue on iOS

Due to a bug in WebKit, the window.indexedDB property is read-only and cannot be overridden by IndexedDBShim. Until the bug is fixed, the only workaround is to create an indexedDB variable in your closure. That way, all code within that closure will use the variable instead of the window.indexedDB property. For example:

(function() {
    // This works on all devices/browsers, and only uses IndexedDBShim as a final fallback 
    var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;

    // This code will use the native IndexedDB if it exists, or the shim otherwise
    indexedDB.open("MyDatabase", 1);
})();

Windows

Windows 8 and 8.1 support IndexedDB natively, so the plugin won't do anything by default.

Windows 8.x's implementation of IndexedDB is mising some features, such as compound keys and compound indexes. If you need those features in your app, then you may want to use this plugin rather than the native implementation. To do that, add the following line of cose to your app:

window.shimIndexedDB.__useShim()

Windows Phone

Windows Phone does not support IndexedDB or WebSQL, so this plugin will automatically load the asynchronous WebSQL plugin to add WebSQL support, and then use IndexedDBShim to expose WebSQL to your app via the IndexedDB API. It's complicated, but it works. :)

The WebSQL plugin is specifically written for Windows Phone, so it only supports the two processor architectures that Windows Phone supports (x86 and arm). This means that you need to specify an extra flag when building your Windows Phone app via Cordova:

cordova build windows --archs="x86 arm" -- --phone