mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
16 lines
564 B
JavaScript
16 lines
564 B
JavaScript
|
'use strict';
|
||
|
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 }, {
|
||
|
'try': function (callbackfn) {
|
||
|
var promiseCapability = newPromiseCapabilityModule.f(this);
|
||
|
var result = perform(callbackfn);
|
||
|
(result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
|
||
|
return promiseCapability.promise;
|
||
|
}
|
||
|
});
|