【ES9(2018)】Promise.prototype.finally()
发布日期:2021-05-13 00:16:28 浏览次数:10 分类:精选文章

本文共 2320 字,大约阅读时间需要 7 分钟。

Promise.prototype.finally()���������������������������

���JavaScript���Promise������������Promise.prototype.finally()���������������������������������������������������Promise������������������������������������������������������������������������������������������������������������������������������������������������ cleanup���������������������������������������������������������������������������

finally���������������������

finally������������������������Promise���������Promise���������������������Promise������������������������������������Promise���then()���catch()������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������

������1���loading������

���UI������������������loading���������������������������������������������������������������������������������������loading���������������������������������������������������������������������������������������������������������������������loading���������������������������������������������������������������������loading������������finally������������������������������������������������������������������������then()���catch()���������������������������������������������������������������������������������������������

������2������������������������

let connection = null;

db.open().then(() => { connection = $this;return connection.select({ name: 'Jane' });}).then(result => {// ������������// ������connection������������������}).catch(error => {// ������������}).finally(() => {connection.close();})

���������������������������������������finally��������������������������� Promise ������������������������������������������������������connection.close()������������������������������������then()���catch()������������������������ clearance ������������������������������������������������������������������������

���������Promise.prototype.finally()���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

上一篇:【ES9(2018)】String 扩展
下一篇:【ES9(2018)】Object Rest & Spread

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年04月24日 23时52分29秒