FYI, this could be a useful pattern for the HomeProvider calls that hub
add-ons make. Also, it isn't a high priority, but I filed bug 990066 about
updating HomeProvider.jsm code to use this pattern.

Margaret

---------- Forwarded message ----------
From: Myk Melez <m...@mozilla.org>
Date: Fri, Mar 28, 2014 at 5:03 PM
Subject: simplify asynchronous method declarations with Task.async()
To: Firefox Dev <firefox-...@mozilla.org>


 Taskmasters!

tl;dr: where you used to do:

let object = {
  doAsync: function() {
    return Task.spawn((function*() {
      ...
    }).bind(this));
  }
};

You can now do simply:

let object = {
  doAsync: Task.async(function*() {
    ...
  })
};

Read my blog post for the details:

    http://mykzilla.blogspot.com/2014/03/simplify-asynchronous-method.html

-myk


_______________________________________________
firefox-dev mailing list
firefox-...@mozilla.org
https://mail.mozilla.org/listinfo/firefox-dev
_______________________________________________
mobile-firefox-dev mailing list
mobile-firefox-dev@mozilla.org
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to