Skip to content

Support ES6 Promises, in particular to support ServiceWorker #23007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alan-knight opened this issue Mar 26, 2015 · 12 comments
Open

Support ES6 Promises, in particular to support ServiceWorker #23007

alan-knight opened this issue Mar 26, 2015 · 12 comments
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug web-dart2js

Comments

@alan-knight
Copy link
Contributor

DOM APIs are starting to use Promises, most notably ServiceWorker. But this is a language feature, and it would be better to support it at the language level mapping it to a Future than to do a one-off in dart:html.

@DartBot
Copy link

DartBot commented Apr 7, 2015

This comment was originally written by @kaendfinger


Are there any fundamental differences between Future and Promise? AFAIK, the only thing that is different is a way to tell if the promise has been resolved, which future does not have.

@alan-knight
Copy link
Contributor Author

I don't think there are fundamental differences, it should mostly just be a matter of adding the conversion operations.

@DartBot
Copy link

DartBot commented Apr 7, 2015

This comment was originally written by @zoechi


@kaendfinger If you use a Completer instead of a Future you get can check using Completer.isCompleted

@DartBot
Copy link

DartBot commented Apr 9, 2015

This comment was originally written by @kaendfinger


Ok, just verifying :) Thanks

@sigmundch
Copy link
Member

Removed this from the 1.10 milestone.
Added this to the 1.11 milestone.

@alan-knight
Copy link
Contributor Author

Marked this as blocking #22862.

@DartBot
Copy link

DartBot commented May 23, 2015

This comment was originally written by @kaendfinger


I wrote a promise class for atom.dart, along with a function to convert it to a future.

https://github.com/DirectMyFile/atom.dart/blob/master/lib/utils.dart#L14-L51

It's using JS interop btw.

@alan-knight
Copy link
Contributor Author

kaendfinger: Cool. I don't see a license on atom.dart. Can I use the code? I don't think it's difficult, but why write it again...

@DartBot
Copy link

DartBot commented May 29, 2015

This comment was originally written by @kaendfinger


Oh of course. I need some sort of bot to scan my projects for licenses. It's under the MIT license. Let me push that up just in case :)

@alan-knight alan-knight added Type-Enhancement P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js labels May 29, 2015
@alan-knight alan-knight added this to the 1.11 milestone May 29, 2015
@sigmundch sigmundch modified the milestones: 1.12, 1.11 Jun 10, 2015
@sigmundch sigmundch modified the milestones: 1.12, 1.13 Aug 17, 2015
@sigmundch sigmundch removed this from the 1.13 milestone Sep 16, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@rakudrama
Copy link
Member

Another user is hitting the Promise/Future interop problem: #27253

@mfrancis107
Copy link

Just want to add some info to this issue.

Browser's are starting to add more and more API's that use Promise instead of call back functions. Any new API's introduced to the standard are going to use promises instead of call backs.

Another example being the new VR/XR apis found here:
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getVRDisplays

@vsmenon vsmenon added the area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. label Jul 20, 2019
@vsmenon
Copy link
Member

vsmenon commented Jul 22, 2019

Note, there is now limited support via:

https://api.dartlang.org/dev/2.5.0-dev.1.0/dart-html/promiseToFuture.html

@vsmenon vsmenon added P3 A lower priority bug or feature request and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug web-dart2js
Projects
None yet
Development

No branches or pull requests

7 participants