[quota-api] API change suggestions

Hi,

I'm very happy with the API changes we where able to make to the Quota
API, but there's a method name we have left untouched and that I haven't
figured out how to tackle until today: queryUsageAndQuota.

The name is horrendous and is going to make developers cringe. It's also
not very extensible should need arise to provide extra information in the
future.

Here's a suggestion to fix it:

1) create a new StorageQuotaInfo interface:

WebIDL:

interface StorageQuotaInfo {
  readonly attribute unsigned long long quota;
  readonly attribute unsigned long long usage;
};


2) Rename StorageUsageCallback to StorageInfoCallback and pass it a
StorageQuotaInfo instead of two ints:

WebIDL:
callback StorageInfoCallback = void (StorageQuotaInfo storageQuotaInfo);



3) Rename queryUsageAndQuota to getInfo:

WebIDL:

interface StorageQuota {
  void getInfo (in StorageInfoCallback successCallback, in optional
StorageErrorCallback errorCallback);
  ...
};

The examples in the spec would be rewritten as shown here:
https://gist.github.com/3690242


Thoughts?


Again, happy to contribute those changes if there's interest.

Best,

--tobie

Received on Monday, 10 September 2012 10:47:09 UTC