remotestorage.js icon indicating copy to clipboard operation
remotestorage.js copied to clipboard

return version age in baseclient getFile function

Open michielbdejong opened this issue 11 years ago • 2 comments
trafficstars

Use case: Currently the function for updating my website retrieves the JSON from which the html is generated with a maxAge of 1 million; when this fails and the error message starts with "cannot fulfill maxAge requirement -" then it retries with a maxAge of 1 billion, to check if it still fails with this more relaxed requirement.

That way it can more or less display appropriate warnings to the user "warning: editing a cached version that is more than 20 minutes old", or: "warning: this device has been offline for more than 10 days".

Having to guess the age of the latest available version of a document by trial and error is of course suboptimal.

The baseclient getFile function already fulfills with an object containing a 'data' and a 'mimeType' field. Adding an 'age' field to this might be useful for displaying warnings and letting the user decide whether continuing to work offline is still wise.

michielbdejong avatar Apr 23 '14 09:04 michielbdejong

Why would it be different for files vs documents? Appending the core file data with arbitrary metadata that is unavailable for non-files seems inconsistent to me.

raucao avatar Apr 23 '14 09:04 raucao

ok, so we can add it there as well, I guess

michielbdejong avatar Apr 23 '14 09:04 michielbdejong