Open awwx opened 11 years ago
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!
Thanks! But sadly a key-value store abstraction isn't enough for what offline data needs.
IE and Firefox don't support Web SQL Database; adding IndexedDB support would allow these browsers to use data offline as well.