Hello Everybody,
Now that we have support for IndexedDB and WebSQL in our Javascript library, i've
started a fallback strategy for DataManager.
There will need to be a bit of deprecation since the 2 new adapters are asynchronous and
return a promise/callbacks and the other adapters are synchronous and return the actual
data.
We are thinking of adding an option, "aysnc", the name is up for debate, which
would only be valid for the memory and session/local adapters and would default to false
and things would return as normal( this would also be removed in the next release and
everything would be "async" ), but if true, then these adapters would return
like the 2 new adapters, using callbacks/promises.
Now on to the Fallback Strategy:
Here is a use case:
I'm a user, i create an IndexedDB store, but the device/browser i'm using
doesn't support it. I think there are 2 options we can go down here
1. The user gets an error back about IndexedDB being not support, just like regular. And
they need to "opt-in" to the fallback stuff. this would be an option on the
"add" of the Store. Maybe the actual Constructor?
They would also be able to provide a list of adapters to try which would override our
predefined list.
2. Fallback is assumed and there is no option, it just happens, using our predefined
list.
There is still the question of if the fallback is used, and a "Asynchronous"
store falls back to a "Synchronous" one, what should be returned. I'm
thinking what ever the return value of the "Async" one was.
I don't see this as breaking API since the "sync" store was not meant to be
created "directly"
So if they create an IndexedDB store and it fallbacks to a memory adapter, this store
will use the "async" model
Thoughts, comments, cat pictures,
-Luke