Promise.prototype.finally = function (callback) { let P = this.constructor; return this.then( value => P.resolve(callback()).then(() => value), reason => P.resolve(callback()).then(() => { throw reason }) ); };
模拟实现一个 Promise.finally
猜你喜欢
转载自blog.csdn.net/qq_34629352/article/details/104964479
今日推荐
周排行