Open Bug 1055248 Opened 12 years ago Updated 4 years ago

Device Storage - Use promises or callbacks passed as parameters for consistency with other APIs

Categories

(Core :: DOM: Core & HTML, defect, P5)

All
macOS
defect

Tracking

()

People

(Reporter: dmarcos, Unassigned)

Details

The current API returns a request object where the user is expected to attach the callbacks: var req = navigator.getDeviceStorage('pictures').addNamed(blob, filepath); req.onerror = function() { ... }; req.onsuccess = function() { ... }; We should be using either callbacks passed as a parameter: It's a better indicator for the user that the operation is asynchronous navigator.getDeviceStorage('pictures').addNamed(blob, filepath, onsuccess, onerror); Or we could use promises instead: navigator.getDeviceStorage('pictures').addNamed(blob, filepath).then(onsuccess, onerror); The two options above are fine to me but we should make sure that we follow the same pattern than other modern APIs. Promises seems the direction we're taking.
Summary: Device Storage - Update the API for consistency with other APIs → Device Storage - Use promises or callbacks passed as parameters for consistency with other APIs
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.