Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 450e051

Browse filesBrowse files
committed
stream: simplify createPromiseCallback
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #62650 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 1e8fa2f commit 450e051
Copy full SHA for 450e051

1 file changed

+2-8Lines changed: 2 additions & 8 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/webstreams/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/util.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
MathMax,
1212
NumberIsNaN,
1313
PromisePrototypeThen,
14+
ReflectApply,
1415
ReflectGet,
1516
Symbol,
1617
SymbolAsyncIterator,
@@ -166,15 +167,9 @@ function enqueueValueWithSize(controller, value, size) {
166167
controller[kState].queueTotalSize += size;
167168
}
168169

169-
// This implements "invoke a callback function type" for callback functions that return a promise.
170-
// See https://webidl.spec.whatwg.org/#es-invoking-callback-functions
171-
async function invokePromiseCallback(fn, thisArg, ...args) {
172-
return FunctionPrototypeCall(fn, thisArg, ...args);
173-
}
174-
175170
function createPromiseCallback(name, fn, thisArg) {
176171
validateFunction(fn, name);
177-
return (...args) => invokePromiseCallback(fn, thisArg, ...args);
172+
return async (...args) => ReflectApply(fn, thisArg, args);
178173
}
179174

180175
function isPromisePending(promise) {
@@ -281,7 +276,6 @@ module.exports = {
281276
extractHighWaterMark,
282277
extractSizeAlgorithm,
283278
lazyTransfer,
284-
invokePromiseCallback,
285279
isBrandCheck,
286280
isPromisePending,
287281
peekQueueValue,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.