Re: [whatwg/streams] Add helpers to use initial values of Promise methods (#1010)

MattiasBuelens 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) {

Sounds reasonable. I'll rename them. 🙂

-- 
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_r315819463

Received on Tuesday, 20 August 2019 17:43:53 UTC