Closed gr2m closed 7 years ago
π @hoodiehq/maintainers this PR is ready for review π
Itβs the final one to drop the localStorage dependency from Hoodie and make it work everywhere PouchDB does :) π https://github.com/hoodiehq/camp/issues/101
Please let me do the merging.
π part of https://github.com/hoodiehq/camp/issues/101. closes #116, closes #117, closes #118
This hurts me a bit, because the API becomes more complex as it is today. Instead of just doing
we now have to do
We could only support the synchronous API without a bootstrapping because we relied on the synchronous APIs of
localStorage
. We decided that we have to drop that dependency if we want hoodie to run in other environments where localStorage is not available, like Service Worker, Node.js or native environments like React Native or Electron.On the plus side, once
hoodie.ready
is resolved, the API remains as it is today, and we can expose a hook which would allow plugins for asynchronous initialisation, too.Progress
@hoodie/client-account
βsoptions.cache
for async storage@hoodie/connection-status
βoptions.cache
for async storagehoodie.ready
API which waits for theaccount.ready
andconnectionStatus.ready
to resolve@hoodie/client-account
and@hoodie/connection-status
and update@hoodie/client
βspackage.json
BREAKING CHANGE:
Hoodie dropped its dependency on localStorage in order to work in non-browser environments. In order to make that work we have to use async store APIs to load the current state like the session id, username or the connection status.
The APIs
hoodie.account
,hoodie.store
andhoodie.connectionStatus
can now only be used after the promise returned byhoodie.ready
resolves.