Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quota Management API Review Notes

Notes

  • References to storage specs seem a bit off.

    • WEBSTORAGE is in HTML now, right?
    • FileSystem APIs are too in flux
    • WebSQL is dead
  • The Promise interface is currently defined and discussed in the WHATWG DOM specification.

    Should reference ES6

  • In the example, initializeCache needs a bit more explaining that it's a user cache

  • StorageInfo should not be a [NoInterfaceObject] interface, with a prototype and everything. It should just be a dictionary. In other words, it should have Object.prototype as its prototype, instead of StorageInfo.prototype, where StorageInfo is an un-callable function.

  • Actually, the same applies to StorageQuota, for different reasons. It's used as a namespace, not as a class, and WebIDL dictionaries match that better I think. (I dunno, this might not be a battle worth fighting; I guess this is just how navigator-extending specs work these days. You create a non-constructable class with the appropriate methods, somehow magically construct an instance of that class, then make that instance a property of navigator. Wheeeeee.)

  • readonly attribute StorageType[] supportedTypes;: we should make sure this is a frozen array object, as per recent discussion by Jonas et al. in that bug. I assume this cannot change at runtime (but this would be good for the spec to clarify)

  • Use DOMException to reject promises, not DOMError.

  • StorageWatcher could benefit from an example.

  • StorageWatcher rate parameter should probably be in milliseconds, not seconds---timespans in JavaScript are usually milliseconds.

Nitpicks

Examples

this section probably needs to be marked non-normative

optinally

typo

Positive Feedback

Constructors for StorageWatcher and StorageEvent, yay!

Pretty nice promise usage and verbiage, modulo the DOMError snafu.

Overall, very nice, simple, and idiomatic.

@twirl

This comment has been minimized.

Show comment
Hide comment
@twirl

twirl Feb 10, 2014

Two moments:

  1. In my opinion, API should provide methods both for increasing and descreasing quota. I could imagine a webapp that allows user to set desirable size of local cache.
  2. We may also expand quota functionality a bit further to make it possible to obtain details on quota usage by different types of storage (i.e. how much space IndexedDB or localStorage uses). I think it might be usable in some situations.

twirl commented Feb 10, 2014

Two moments:

  1. In my opinion, API should provide methods both for increasing and descreasing quota. I could imagine a webapp that allows user to set desirable size of local cache.
  2. We may also expand quota functionality a bit further to make it possible to obtain details on quota usage by different types of storage (i.e. how much space IndexedDB or localStorage uses). I think it might be usable in some situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment