W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

[quota-api] API change suggestions

From: Tobie Langel <tobie@fb.com>
Date: Mon, 10 Sep 2012 10:46:41 +0000
To: Kinuko Yasuda <kinuko@chromium.org>, "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <CC7391B5.23F77%tobie@fb.com>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT