-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Comments
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. |
I don't think there are fundamental differences, it should mostly just be a matter of adding the conversion operations. |
This comment was originally written by @zoechi @kaendfinger If you use a Completer instead of a Future you get can check using Completer.isCompleted |
This comment was originally written by @kaendfinger Ok, just verifying :) Thanks |
Marked this as blocking #22862. |
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. |
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... |
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 :) |
Another user is hitting the Promise/Future interop problem: #27253 |
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: |
Note, there is now limited support via: https://api.dartlang.org/dev/2.5.0-dev.1.0/dart-html/promiseToFuture.html |
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.
The text was updated successfully, but these errors were encountered: