Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9311612
es.promise.catch.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
es.promise.catch.js
View Options
'use strict'
;
var
$
=
require
(
'../internals/export'
);
var
IS_PURE
=
require
(
'../internals/is-pure'
);
var
FORCED_PROMISE_CONSTRUCTOR
=
require
(
'../internals/promise-constructor-detection'
).
CONSTRUCTOR
;
var
NativePromiseConstructor
=
require
(
'../internals/promise-native-constructor'
);
var
getBuiltIn
=
require
(
'../internals/get-built-in'
);
var
isCallable
=
require
(
'../internals/is-callable'
);
var
defineBuiltIn
=
require
(
'../internals/define-built-in'
);
var
NativePromisePrototype
=
NativePromiseConstructor
&&
NativePromiseConstructor
.
prototype
;
// `Promise.prototype.catch` method
// https://tc39.es/ecma262/#sec-promise.prototype.catch
$
({
target
:
'Promise'
,
proto
:
true
,
forced
:
FORCED_PROMISE_CONSTRUCTOR
,
real
:
true
},
{
'catch'
:
function
(
onRejected
)
{
return
this
.
then
(
undefined
,
onRejected
);
}
});
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
if
(
!
IS_PURE
&&
isCallable
(
NativePromiseConstructor
))
{
var
method
=
getBuiltIn
(
'Promise'
).
prototype
[
'catch'
];
if
(
NativePromisePrototype
[
'catch'
]
!==
method
)
{
defineBuiltIn
(
NativePromisePrototype
,
'catch'
,
method
,
{
unsafe
:
true
});
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 10:24 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3353504
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment