- From: Adam Rice <notifications@github.com>
- Date: Mon, 19 Aug 2019 18:27:05 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1010/review/276890371@github.com>
ricea commented on this pull request. > @@ -157,11 +157,38 @@ exports.MakeSizeAlgorithmFromSizeFunction = size => { return chunk => size(chunk); }; -exports.PerformPromiseThen = (promise, onFulfilled, onRejected) => { +const originalPromise = Promise; +const originalPromiseThen = Promise.prototype.then; +const originalPromiseResolve = Promise.resolve; +const originalPromiseReject = Promise.reject; + +function CreatePromise(executor) { + return new originalPromise(executor); +} + +function PromiseResolve(value) { + return originalPromiseResolve.call(originalPromise, value); +} + +function PromiseReject(reason) { Generally where we have a function that's not an abstract operation we start it with a lowercase letter, but I'm not 100% sure whether that's the right thing to do with these. `PerformPromiseCatch` is probably too misleading, as it makes it sound like it is a standard operation. I think we can split it into two cases: `setPromiseIsHandled()` and `rethrowAssertions()`. I think I prefer to use the names from the promises guide, so we have `aNewPromise()`, `aPromiseRejectedWith()`, and `aPromiseResolvedWith()`. Yes, these names are ugly but they help the reference implementation match the standard text. We should probably explicitly write `aPromiseResolvedWith(undefined)` to get it to read smoothly. Since this contradicts what you want to do, I'd like to ask @domenic to be the stylistic judge here. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/1010#discussion_r315474067
Received on Tuesday, 20 August 2019 01:27:27 UTC