Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
564 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var newPromiseCapabilityModule = require('../internals/new-promise-capability');
|
---|
4 | var perform = require('../internals/perform');
|
---|
5 |
|
---|
6 | // `Promise.try` method
|
---|
7 | // https://github.com/tc39/proposal-promise-try
|
---|
8 | $({ target: 'Promise', stat: true }, {
|
---|
9 | 'try': function (callbackfn) {
|
---|
10 | var promiseCapability = newPromiseCapabilityModule.f(this);
|
---|
11 | var result = perform(callbackfn);
|
---|
12 | (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
|
---|
13 | return promiseCapability.promise;
|
---|
14 | }
|
---|
15 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.