Closed Bug 1033967 Opened 11 years ago Closed 9 years ago

Use DOM Promises for MozLoopAPI functions where callbacks are currently used

Categories

(Hello (Loop) :: Client, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
backlog tech-debt

People

(Reporter: standard8, Unassigned)

References

Details

(Whiteboard: [tech-debt])

Attachments

(1 file)

Attached file Example patch
We should use DOM promises for the MozLoopAPI functions which are currently based around callbacks. The main functions to swap are currently ensureRegistered and hawkRequest. Switching to use DOM promises isn't too difficult in itself (see example patch), the slightly more complicated bit is integrating into the Mocha & chai tests. There's information on that here: For the records Mocha supports promises; quoting http://visionmedia.github.io/mocha/#asynchronous-code: > Alternately, instead of using the done() callback, you can return a promise. They also use https://github.com/domenic/chai-as-promised/ to extend the Chai expectation API.
(In reply to Mark Banner (:standard8) from comment #0) > They also use https://github.com/domenic/chai-as-promised/ to extend the > Chai expectation API. Additional xref http://chaijs.com/plugins/chai-as-promised
backlog: --- → -
backlog: - → tech-debt
Priority: -- → P4
Whiteboard: [tech-debt]
I'm wontfixing this, as we're changing the MozLoopAPI due to e10s to use a message passing mechanism, and this is unlikely to fit with promises.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: