<div dir="ltr">It's pretty much drop in. The only slight difference I can think of is that you can't "await" on a generator function like you could yield one before, you must always await the result of an async function or a promise.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 3:39 PM, Mike Conley <span dir="ltr"><<a href="mailto:mconley@mozilla.com" target="_blank">mconley@mozilla.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm all for it.<br>
<br>
For the people who are more familiar with async / await than I am, and<br>
have also used Task.jsm, are there any gotchas, or is it pretty much a<br>
drop-in replacement?<br>
<br>
-Mike<br>
<div><div class="h5"><br>
On 2017-03-16 6:29 PM, Dave Townsend wrote:<br>
> For a long time now we've been writing JS code that waits for promises<br>
> using Task.jsm and generator functions. Recently though the JS team<br>
> added support for the JS standard way of doing this, async/await:<br>
> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function" rel="noreferrer" target="_blank">https://developer.mozilla.org/<wbr>en-US/docs/Web/JavaScript/<wbr>Reference/Statements/async_<wbr>function</a><br>
><br>
> Writing code in standard JS is always better for the web, makes it<br>
> easier to onboard new engineers and allows for better support in<br>
> developer tools. So I'd like to propose that we switch to the standard<br>
> way of writing these functions immediately. New code should use<br>
> async/await instead of Task.jsm going forwards.<br>
><br>
> Florian has some rough plans to automatically rewrite existing usages of<br>
> Task.jsm to the standard JS forms so for now don't worry much about<br>
> going and submitting patches to fix up existing code. Once that is done<br>
> we can remove Task.jsm from the tree.<br>
><br>
> Does anyone object to any of this?<br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> firefox-dev mailing list<br>
> <a href="mailto:firefox-dev@mozilla.org">firefox-dev@mozilla.org</a><br>
> <a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/<wbr>listinfo/firefox-dev</a><br>
><br>
______________________________<wbr>_________________<br>
firefox-dev mailing list<br>
<a href="mailto:firefox-dev@mozilla.org">firefox-dev@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/<wbr>listinfo/firefox-dev</a><br>
</blockquote></div><br></div></div></div>