RE: How can I synchronously determine a JavaScript Promise's state? (Domenic Denicola)

2015-06-02 Thread Ron Waldon
Apologies if this is a duplicate: I'm new to mailing lists and got a little bit muddled. ## legacy use case I am maintaining an existing API that includes asynchronous functions (mix of callbacks and Promises) and synchronous functions. After some asynchronous initialisation, the internal state

Re: How can I synchronously determine a JavaScript Promise's state?

2015-06-01 Thread C. Scott Ananian
Why not just use a subclass of Promise? I don't see why that has to be part of the base class. ``` class ObservablePromise extends Promise {} ObservablePromise.prototype.isSettled = function() { return !!this.isSettled; }; ObservablePromise.prototype.then = function(res, rej) { return

RE: How can I synchronously determine a JavaScript Promise's state?

2015-06-01 Thread Domenic Denicola
I will repeat to you what I said on Specifiction: To get a standard API for this, you'll need to convince the JavaScript standard committee, as well as the browser vendors, that your use case is widespread and important enough to be worth the standardization and implementation burden, and

Re: How can I synchronously determine a JavaScript Promise's state?

2015-06-01 Thread Ron Waldon
## legacy use case I am maintaining an existing API that includes asynchronous functions (mix of callbacks and Promises) and synchronous functions. After some asynchronous initialisation, the internal state settles and it is perfectly safe to use the synchronous functions as expected. So, I'd