On 2014-09-26, 5:20 PM, Jonas Sicking wrote:
Also currently mozSettings.createLock().get()/set() doesn't smell nice. A promise is something developer wants. It'd be nice if we have read/write without creating a lock and maintain on our own.[4] ```js mozSettings.read('lockscreen.enabled').then(function(value) {}); ```This I completely agree with. The createLock() function provides transactional protection, but I suspect that's not something we really need for settings. That was my bad idea.
Do you mean we can just remove the locking concepts from this API?
And yes, we should definitely switch from using DOMRequest to using Promises. I think we can actually do this as a two-step process. 1. Add a .then() function to DOMRequest. This will magically make all DOMRequests also work as promises. While still maintaining backwards compatibility so that we don't have to rewrite all existing code at once.
Just assigned bug 839838 to myself. :-)
2. At whatever pace we think is appropriate, change our APIs to return Promises rather than a DOMRequests. Step 1 is actually fairly easy and would mean that gaia developers could immediately start using Promise syntax anywhere where we use DOMRequests right now. / Jonas _______________________________________________ dev-gaia mailing list [email protected] https://lists.mozilla.org/listinfo/dev-gaia
_______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
