Localstorage package with async api for better mobile support #1860

Closed
raix opened this Issue Feb 25, 2014 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

raix commented Feb 25, 2014

Could we please use something like https://github.com/mozilla/localForage instead of the localstorage package - and have accounts use the async api?

I've made a couple of packages making Meteor run on chrome mobile packaged apps / phonegap / cordova / Firefox OS / node webkit etc. Most of these break when it comes to accounts - since accounts relies on the sync version of localstorage.

Why: localstorage blocks

@raix raix referenced this issue in SpaceCapsule/Meteor-cordova Feb 25, 2014

Open

Does this work with meteor 0.7.0.1 + cordova v3.3.x ? #15

i'm interested in this as well... be careful with this, "meteor+mobile=awesome"

Owner

n1mmy commented Mar 4, 2014

This is interesting. Sounds like a cool feature to add someday.

A start might be a localforage package on atmosphere.

Closing as a feature request. https://github.com/meteor/meteor/wiki/Contributing-to-Meteor#wiki-making-changes-to-meteor-core

@n1mmy n1mmy closed this Mar 4, 2014

crossposting for reference, see issue #2643


In more research on this, I've heard that localStorage may be un-reliable on cordova (the OS can clear localStorage) and it looks like many people complain about localStorage in general.

But it's certainly the only way (currently) that Meteor stores the login token... see here:
https://github.com/meteor/meteor/blob/611298fb50554b81a1889314ce8745b0b12b2f9d/packages/accounts-base/localstorage_token.js#L66-68

I'm now looking at localForage
Offline storage, improved. Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API.
Already packaged by good ole' @raix here:
https://github.com/raix/Meteor-localforage

Now, I wonder if I can override Meteor._localStorage...

and then from: Morten

@zeroasterisk look at ground:store instead, its tailored meteor, localforage is the inspiration, but the groud:store is more meteor like. (Im using this in ground:db since neither meteor.localstorage nor localforage felt/worked ) it allows local async storage adapters. At the moment ive only written the localstorage adapter, but an adapter for cordova filesystem is to come (we also need this stuff on the CollectionFS project for client side storage)

https://github.com/GroundMeteor/store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment