mozilla/localForage — pull request #101 by nantunes (2014-03-13 17:36:28+00:00)
Title: Checks if localforage is ready for use, waits if needed

If the scripts load very quickly (in my case I'm working offline with everything in the Application Cache), it is possible to a localforage api to be called before the driver initialization is done.

I am using indexeddb driver and when my application did a localforage.get(..) it failed with "Cannot call method 'transaction' of null", because db was still null.

I've added the promise returned by setDriver to all the drivers public methods.

Questions to resolve:
* I've called the promise _ready, with the underscore announcing it as private, but maybe it would also be useful outside as a public api;
* The drivers access localforage global variable, with breaks jshint current rules: should we add it to .jshintrc or is there another way to access the attribute?

Globally I'm not totally happy with the design of the solution, but it solved my project bug.