- From: Domenic Denicola <notifications@github.com>
- Date: Tue, 21 Apr 2020 19:58:58 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 22 April 2020 02:59:11 UTC
@domenic commented on this pull request.
> +
+// https://heycam.github.io/webidl/#resolve
+function resolvePromise(p, value) {
+ promiseSideTable.get(p).resolve(value);
+ promiseSideTable.get(p).stateIsPending = false;
+}
+
+// https://heycam.github.io/webidl/#reject
+function rejectPromise(p, reason) {
+ promiseSideTable.get(p).reject(reason);
+ promiseSideTable.get(p).stateIsPending = false;
+}
+
+// https://heycam.github.io/webidl/#a-promise-resolved-with
+function promiseResolvedWith(value) {
+ // Cannot use original Promise.resolve since that will return value itself sometimes, unlike Web IDL.
It is, because then we don't end up with a weak map entry for the promise sometimes.
This implementation is actually more in line with Web IDL's "promised resolved with" than one that uses `Promise.resolve`; Web IDL always creates a new promise.
--
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/1035#discussion_r412632360
Received on Wednesday, 22 April 2020 02:59:11 UTC