Make the Promise module available to Toolkit consumers

RESOLVED DUPLICATE of bug 756542

Status

()

Toolkit
General
RESOLVED DUPLICATE of bug 756542
6 years ago
6 years ago

People

(Reporter: Paolo, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
(In reply to Dave Townsend (:Mossop) from comment #107)
> We still need to figure out packaging it into the build and making it
> available to all consumers, it might be better to do that in other bugs now
> that this one is past 100 comments!

I've filed this bug as the last step that allows implementing basic "Task.js"
interfaces in bug 763311.

I think the discussion here will be about the JSM module name, and whether and
how we should namespace the exported functions.
(Reporter)

Comment 1

6 years ago
Created attachment 643108 [details] [diff] [review]
Temporary glue code.

I've implemented a temporary glue stub in order to make the dependent bugs work.

With this, there's a working queue made of bug 763295, bug 774816, bug 763311,
and bug 740468 with which the asynchronous bookmarks export that uses Task.jsm
can be tried out.

I've namespaced the module, and I'm also proposing to rename the exported
"resolve" function to "resolved", and "reject" to "rejected", because they're
substantially different from the "resolve" and "reject" functions that exist
on the object returned by "defer".

In fact, "deferred.resolve" allows the associated promise to be resolved or
rejected (active action, no return value), while "Promise.resolved" returns a
new promise that is already resolved (has a definite return value).
(Reporter)

Comment 2

6 years ago
Just noticed that if the module functions are namespaced, you can do this:

XPCOMUtils.defineLazyModuleGetter(this, "Promise",
                                  "resource://gre/modules/Promise.jsm");
(Reporter)

Updated

6 years ago
Blocks: 775495
(Reporter)

Comment 3

6 years ago
It appears bug 756542 will make the promise/core.js module loadable directly,
I'm moving the discussuion there.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 756542
(In reply to Paolo Amadini [:paolo] from comment #1)
> Created attachment 643108 [details] [diff] [review]
> Temporary glue code.
> 
> I've implemented a temporary glue stub in order to make the dependent bugs
> work.
> 
> With this, there's a working queue made of bug 763295, bug 774816, bug
> 763311,
> and bug 740468 with which the asynchronous bookmarks export that uses
> Task.jsm
> can be tried out.
> 
> I've namespaced the module, and I'm also proposing to rename the exported
> "resolve" function to "resolved", and "reject" to "rejected", because they're
> substantially different from the "resolve" and "reject" functions that exist
> on the object returned by "defer".

I second this suggestion.
You need to log in before you can comment on or make changes to this bug.