1 | ;
|
2 |
|
3 | var Promise = require('./core.js');
|
4 |
|
5 | module.exports = Promise;
|
6 | Promise.prototype['finally'] = function (f) {
|
7 | return this.then(function (value) {
|
8 | return Promise.resolve(f()).then(function () {
|
9 | return value;
|
10 | });
|
11 | }, function (err) {
|
12 | return Promise.resolve(f()).then(function () {
|
13 | throw err;
|
14 | });
|
15 | });
|
16 | };
|