Re: [storage] Change persistentPermission() to persistent() (#7)

I think there's three things we care about:

1. Ask the user and change the default box.
2. Check whether you have permission.
3. Check whether the default box is changed.

Having thought about it some more, my proposal is to change the return value of `requestPersistent()` to be a boolean, representing whether or not the default box is persistent.

This means:

* If permission is "denied", `requestPersistent()` will return false.
* If permission is "default", `requestPersistent()` will ask the user, maybe change the default storage to persistent, and then return whether or not the default box is persistent.
* If permission is "granted", `requestPersistent()` will maybe change the default storage to persistent (if that hasn't happened already), and then return true.
* `persistentPermission()` will always return the permission value.

I think this API satisfies all the criteria and is not awful.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/storage/issues/7#issuecomment-126579613

Received on Friday, 31 July 2015 06:29:39 UTC