Closed pashute closed 6 years ago
Thanks for your help!
So how would you describe the difference between syncBackground true and false? When is the old (stale) info given, and when is the new data returned, in the (default) case of true?
On Mon, Sep 3, 2018 at 7:20 PM Sunny Luo notifications@github.com wrote:
@sunnylqm commented on this pull request.
In README.md https://github.com/sunnylqm/react-native-storage/pull/193#discussion_r214731333 :
Load batch data
-// Load batch data with the same parameters as storage.load, but in an array. -// It will invoke sync methods on demand, -// and finally return them all in an ordered array. +// Load batch data with an array of `storage.load` parameters. +// It will invoke each key's sync method, +// and when all are complete will return all the data in an ordered array. +// The sync methods behave according to the syncInBackground setting: (default true) +// When set to true (the default), if timed out will return the current value timed out sounds like network timeout. Any better wording? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/sunnylqm/react-native-storage/pull/193#pullrequestreview-151846082>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABsSM29WuYw9Jf-5c7ZYZomH6PNnsBuOks5uXVbCgaJpZM4WXwM_> .
// syncInBackground (default: true) means if data expired,
// return the outdated data first while invoking the sync method.
// If syncInBackground is set to false, and there is expired data,
// it will wait for the new data and return only after the sync completed.
// (This, of course, is slower)
If syncInBackground set to true, it always return current data. (sync method only invoked in background, no return. So only new data when load next time.)
// syncInBackground (default: true) means if data expired, // invoke the sync method but return with the outdated data.// Once the sync completes this method's callback will be invoked a second time
// If syncInBackground is set to false and there is expired data, // it will wait for the new data and return only after the sync method completed.// (This, of course, is slower)
On Wed, Sep 5, 2018 at 6:54 AM Sunny Luo notifications@github.com wrote:
// syncInBackground (default: true) means if data expired, // return the outdated data first while invoke the sync method. // return the outdated data first while invoking the sync method. // It can be set to false to always return data provided by sync method when expired.(Of course it's slower) // If syncInBackground is set to false, and there is expired data, // it will wait for the new data and return only after the sync completed. // (This, of course, is slower)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sunnylqm/react-native-storage/pull/193#issuecomment-418591400, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsSM_6ZC3kNcYe4xbYCLyDMzLG2XDXSks5uX0r2gaJpZM4WXwM_ .
Corrected the grammar. Hopefully, I understood correctly what you are saying.