Open galfert opened 7 years ago
Do you think this should already be part of the 1.0 release or is it ok to have it in a later release (e.g. 1.1)?
In my opinion, this might get a bit tricky and require some design decisions about how to mark the various instances and then re-initialize them on startup. We can't use the user address, because connecting a storage is not a requirement.
As we will probably want to keep the lib backwards-compatible with just using a single unnamed instance (which I think is totally fine for most apps), I think this should be in 1.1 or later. Basically whenever someone contributed it, and it's merged and ready to use.
@gregkare pointed out that the way we are using the config object from config.js
, it's currently also shared between multiple remoteStorage instances. That's another thing that needs to be changed.
What about optionally letting the app specify the name of the IndexedDB database on instantiation (new RemoteStorage({name: 'rs-cache-foo'})
)?
Good idea. But how would another app use the same DBs/prefixes then? Or maybe that's not necessary for those use cases?
But how would another app use the same DBs/prefixes then?
Apps only have access to their own IndexedDB databases anyway.
Oh wow, that was a big ole brainfart of mine! What was I thinking?
So that makes it a viable solution then, correct?
Yes, I was thinking pretty much of the same thing. Can't see anything that wouldn't work with that solution atm.
At the moment it's only possible to create one single instance at a time.
To allow to use multiple instances, we need to support some kind of namespace for the config in localStorage and the local cache (i.e. indexedDB) to avoid collision.