清空
This commit is contained in:
1 parent
7c2ab0b7ad
commit
cff33ad7d1
6370 files changed
+378844
-82245
No files matched your search
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
// TODO: Remove from `core-js@4`
|
||||
var $ = require('../internals/export');
|
||||
var newPromiseCapabilityModule = require('../internals/new-promise-capability');
|
||||
var perform = require('../internals/perform');
|
||||
|
||||
// `Promise.try` method
|
||||
// https://github.com/tc39/proposal-promise-try
|
||||
$({ target: 'Promise', stat: true, forced: true }, {
|
||||
'try': function (callbackfn) {
|
||||
var promiseCapability = newPromiseCapabilityModule.f(this);
|
||||
var result = perform(callbackfn);
|
||||
(result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
|
||||
return promiseCapability.promise;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user