meteor-offline-data icon indicating copy to clipboard operation
meteor-offline-data copied to clipboard

IndexedDB Support (IE, Firefox)

Open awwx opened this issue 11 years ago • 2 comments

IE and Firefox don't support Web SQL Database; adding IndexedDB support would allow these browsers to use data offline as well.

awwx avatar Jun 14 '13 17:06 awwx

I've successfully used Lawnchair for an Angular project to persist client data. It abstracts IndexedDB, WebSQL, even window.name. This could be a potential solution to this issue.

If you want to dig in, after downloading the lawnchair files, you could create a lawnchair package:

Package.describe({
    summary: "Lawnchair local persistent database abstraction layer"
});

Package.on_use(function (api) {
    api.add_files([
        "Lawnchair.js",
        "webkit-sqlite.js",
        "indexed-db.js",
        "window-name.js",
        "dom.js"
    ], "client");

    api.export("Lawnchair");
});

And then probably within your package, api.use("lawnchair", ...) and create an instance like so:

db = new Lawnchair({
    name: "whatever",
    adapter: ["webkit-sqlite", "indexed-db", "window-name", "dom"]
}, function () {});

then do whatever you need to with db.

Additionally, you may need to add window = this; at the top of each of the lawnchair files (Lawnchair.js, dom.js, indexed-db.js, etc), and also remove the var keyword from var Lawnchair = function (options, callback) { in Lawnchair.js.

Hope this can help!

matb33 avatar Aug 23 '13 18:08 matb33

Thanks! But sadly a key-value store abstraction isn't enough for what offline data needs.

awwx avatar Aug 23 '13 19:08 awwx