Re: Updating Quota API: Promise, Events and some more

On Mon, Aug 19, 2013 at 9:32 AM, Kinuko Yasuda <kinuko@chromium.org> wrote:
>> Actually, *only* having onstoragechange would solve both the use case
>> of detecting when you are running low on storage, as well as when you
>> are "out of the woods". Especially if we provide both the quota and
>> the amount of used space in the event.
>
> Right.  I think probably we should add either "a combination of
> storagelow + storageok" or "storagechange", and the latter would be
> more complete (and possibly be simpler).
>
> One concern for adding storagechange event is how frequently
> the event is going to be fired.  In the former email I tentatively wrote
> this to be fired every 1 second at most frequent (or whenever the
> storage info is changed), but this may be still too frequent if many
> apps are contending to a storage space.  Do you have any opinion
> or preference on this?

I think firing every second while writes are happening would actually
be ok. Seems like you are spending a lot of battery power anyway at
that point and so an extra callback a second doesn't seem like a huge
deal.

That said, doing it more rarely, like every 5 seconds, sounds ok too.

One solution is to punt the choice to the page. I.e. something like:

[Constructor(StorageType type, unsigned long rate)]
interface StorageWatcher {
  readonly attribute StorageType type;
  readonly attribute unsigned long rate;

  attribute EventHandler onstoragechange;
};

/ Jonas

Received on Monday, 19 August 2013 16:50:47 UTC