Hi all

I'm redesigning a bunch of Thunderbird things to be asynchronous. I'd like to use Promises but a lot of the time I'll be far from a JS context so that doesn't really seem like an option. The best alternative I've come up with is to create some sort of listener object and pass it to the async function:

interface nsIFooOperationListener : nsISupports {
  void onOperationComplete(
    in nsresult status,
    [optional] in string errorMessage
  );
};

...

void fooFunction(..., in nsIFooOperationListener listener);

This works fine but I wonder if there's a better way, or if there's some established prior art I can use/borrow rather than find out the pitfalls myself.

TIA,
GL
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to