main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
578 bytes
|
Rev | Line | |
---|
[d24f17c] | 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, forced: 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.