<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Does async/await supersedes Task/yield? Should I replace my Tasks usage with async? Are they interchangeable or will I have to change more?</div><div dir="ltr"><br></div><div dir="ltr">Thanks,</div><div dir="ltr">John</div><div dir="ltr"><br>Am 08.12.2018 um 01:50 schrieb Ben Bucksch <<a href="mailto:ben.bucksch@beonex.com">ben.bucksch@beonex.com</a>>:<br><br></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Given that you run in Thunderbird, you
can assume a modern JS engine, and you can also use async/await
for any function that returns Promises. Googling "javascript async
await" should give you plenty of introductions.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Essentially, something like this should
work:</div>
<div class="moz-cite-prefix">
<pre>async function foo() {
var myWindow = await browser.windows.getCurrent();
}</pre>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">HTH</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Ben<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Geoff Lankow wrote on 08.12.18 01:43:<br>
</div>
<blockquote type="cite" cite="mid:7273445f-1536-e625-58ee-830dd4f711b7@thunderbird.net">
<p>That's a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises" moz-do-not-send="true">Promise</a>, Graeme. Almost all
browser.something.… methods return them.</p>
<p>GL<br>
</p>
<div class="moz-cite-prefix">On 8/12/18 00:49, Graeme wrote:<br>
</div>
<blockquote type="cite" cite="mid:ae732bce-873a-826c-43b6-bf69c9426e33@gmail.com">
<p>I've looked at the docs.</p>
<p>I actually found a lot of help in Owl... I have a "working"
extension and options that work. <br>
</p>
<p>Now I'm trying to get a listener working that will tell me
when a window opens, specifically a compose window... but hey,
any window would be a good start. <br>
</p>
<p>I found in docs, reference to the browser.windows API and a
function getCurrent(). I thought that would be a good test.
There's an event onCreated as well but when I tried <br>
</p>
<p>var MyWindow = browser.windows.getCurrent();</p>
<p>according to docs, MyWindow should be an array with a whole
lot of info. But when I put <br>
</p>
<p>console.dir(MyWindow);</p>
<p>I got <br>
</p>
<p><span class="message-body-wrapper"><span class="message-flex-body"><span class="message-body
devtools-monospace"> </span></span></span></p>
<div class="tree object-inspector" role="tree" tabindex="0">
<div id="Symbol(server1.conn1.obj244)" class="tree-node" role="treeitem" aria-level="1" aria-expanded="true" data-expandable="true">
<div class="node object-node"><img class="arrow expanded" moz-do-not-send="true" src="cid:"><span data-link-actor-id="server1.conn1.obj244" class="objectBox objectBox-object"><span class="objectTitle">Promise</span><span class="objectLeftBrace"> { </span><span class="objectBox objectBox-string">"pending"</span><span class="objectRightBrace"> }</span></span></div>
</div>
<div id="Symbol(server1.conn1.obj244/<state>)" class="tree-node" role="treeitem" aria-level="2" data-expandable="false"><span class="tree-indent"></span>
<div class="node object-node"><span class="object-label">
<state></span><span class="object-delimiter">: </span><span class="objectBox objectBox-string">"pending"</span></div>
</div>
<div id="Symbol(server1.conn1.obj244/<prototype>)" class="tree-node" role="treeitem" aria-level="2" aria-expanded="true" data-expandable="true"><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/catch)" class="tree-node" role="treeitem" aria-level="3" aria-expanded="false" data-expandable="true"> <img class="arrow expanded" moz-do-not-send="true" src="cid:"><span class="object-label"><prototype></span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj247" class="objectBox objectBox-object"><span class="objectTitle">PromiseProto</span></span><span class="tree-indent"></span><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/constructor)" class="tree-node" role="treeitem" aria-level="3" aria-expanded="false" data-expandable="true"><img class="arrow" moz-do-not-send="true" src="cid:"><span class="object-label"> catch</span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj253" class="objectBox objectBox-function" dir="ltr"><span class="objectTitle">function </span>catch()</span><span class="tree-indent"></span><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/finally)" class="tree-node" role="treeitem" aria-level="3" aria-expanded="false" data-expandable="true"><img class="arrow" moz-do-not-send="true" src="cid:"><span class="object-label"> constructor</span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj255" class="objectBox objectBox-function" dir="ltr"><span class="objectTitle">function </span>Promise()</span><span class="tree-indent"></span><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/then)" class="tree-node" role="treeitem" aria-level="3" aria-expanded="false" data-expandable="true"><img class="arrow" moz-do-not-send="true" src="cid:"><span class="object-label"> finally</span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj254" class="objectBox objectBox-function" dir="ltr"><span class="objectTitle">function </span>finally()</span><span class="tree-indent"></span><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/symbol-0)" class="tree-node" role="treeitem" aria-level="3" data-expandable="false"> <img class="arrow" moz-do-not-send="true" src="cid:"><span class="object-label">then</span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj252" class="objectBox objectBox-function" dir="ltr"><span class="objectTitle">function </span>then()</span><span class="tree-indent"></span><span class="tree-indent"></span>
<div id="Symbol(server1.conn1.obj244/<prototype>/<prototype>)" class="tree-node" role="treeitem" aria-level="3" aria-expanded="false" data-expandable="true"><span class="object-label">
Symbol(Symbol.toStringTag)</span><span class="object-delimiter">: </span><span class="objectBox objectBox-string">"Promise"</span><span class="tree-indent"></span><span class="tree-indent"></span>
<div class="node object-node lessen"><img class="arrow" moz-do-not-send="true" src="cid:"><span class="object-label">
<prototype></span><span class="object-delimiter">: </span><span data-link-actor-id="server1.conn1.obj251" class="objectBox objectBox-object"><span class="objectTitle">Object</span><span class="objectLeftBrace"> { </span><span class="more-ellipsis" title="more…">…</span><span class="objectRightBrace"> }</span></span></div>
<div class="node object-node lessen"><span data-link-actor-id="server1.conn1.obj251" class="objectBox objectBox-object"><span class="objectRightBrace">What did I do
wrong? Is there a place to ask more about
how these API work? <br>
</span></span></div>
<br>
<div class="node object-node lessen"><span data-link-actor-id="server1.conn1.obj251" class="objectBox objectBox-object"><span class="objectRightBrace">Blessings<br>
Graeme<br>
</span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="moz-cite-prefix">On 03/12/2018 06:00, Ben Bucksch
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20f5c695-a720-3a75-55eb-e46c0f529df6@beonex.com">Graeme
wrote on 03.12.18 15:50: <br>
<blockquote type="cite"> <br>
I would really like to shift to [WebExtension for
Thunderbird] which seems the addon of the future but where
is there any help for this? <br>
<br>
Could someone do a summary of the conversion effort for this
one please? <br>
</blockquote>
<br>
<br>
First off, it's a completely different type of addon, so be
prepared to have to change a lot. <br>
<br>
For a general intro to WebExtensions, see the Firefox pages: <br>
<br>
<a class="moz-txt-link-freetext" href="https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions" moz-do-not-send="true">https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions</a>
<br>
<br>
<a class="moz-txt-link-freetext" href="https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/What_are_WebExtensions" moz-do-not-send="true">https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/What_are_WebExtensions</a>
<br>
<br>
However, the APIs are different between Thunderbird and
Firefox. Some Firefox APIs work in Thunderbird (just try it),
other Firefox APIs do not work, and Thunderbird has a few
specific APIs added. Here are some docs about the latter ones:
<br>
<br>
<a class="moz-txt-link-freetext" href="https://thunderbird-webextensions.readthedocs.io/en/latest/" moz-do-not-send="true">https://thunderbird-webextensions.readthedocs.io/en/latest/</a>
<br>
<br>
There are not many WebExtensions for Thunderbird yet, our own
Owl is one of the first that I know of, so you're in new
territory. Don't expect a smooth ride. But to be one the
pioneers can be exciting, too. <br>
<br>
HTH, <br>
<br>
Ben <br>
<br>
_______________________________________________ <br>
tb-planning mailing list <br>
<a class="moz-txt-link-abbreviated" href="mailto:tb-planning@mozilla.org" moz-do-not-send="true">tb-planning@mozilla.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://mail.mozilla.org/listinfo/tb-planning" moz-do-not-send="true">https://mail.mozilla.org/listinfo/tb-planning</a>
<br>
<br>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
tb-planning mailing list
<a class="moz-txt-link-abbreviated" href="mailto:tb-planning@mozilla.org" moz-do-not-send="true">tb-planning@mozilla.org</a>
<a class="moz-txt-link-freetext" href="https://mail.mozilla.org/listinfo/tb-planning" moz-do-not-send="true">https://mail.mozilla.org/listinfo/tb-planning</a>
</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
tb-planning mailing list
<a class="moz-txt-link-abbreviated" href="mailto:tb-planning@mozilla.org">tb-planning@mozilla.org</a>
<a class="moz-txt-link-freetext" href="https://mail.mozilla.org/listinfo/tb-planning">https://mail.mozilla.org/listinfo/tb-planning</a>
</pre>
</blockquote>
<p><br>
</p>
</div></blockquote><blockquote type="cite"><div dir="ltr"><span>_______________________________________________</span><br><span>tb-planning mailing list</span><br><span><a href="mailto:tb-planning@mozilla.org">tb-planning@mozilla.org</a></span><br><span><a href="https://mail.mozilla.org/listinfo/tb-planning">https://mail.mozilla.org/listinfo/tb-planning</a></span><br></div></blockquote></body></html>