Terminology “promise” is an object or function with a then method whose behavior conforms to this specification. “thenable” is an object or function t ...
分类:
其他好文 时间:
2021-06-18 19:35:32
阅读次数:
0
When you run hexo g on any web instances, like on AWS or Azure, you might get the following error: (node:3568) ExperimentalWarning: The fs.promises AP ...
分类:
其他好文 时间:
2021-04-12 12:28:51
阅读次数:
0
一、谈谈你是如何理解JS异步编程的,EventLoop、消息队列都是做什么的,什么是宏任务,什么是微任务? 1. 异步编程:回调函数、事件监听、发布/订阅、Promises对象 2. EventLoop是主线程从"任务队列"中读取事件,这个过程是循环不断的,所以整个的这种运行机制又称为Event L ...
分类:
Web程序 时间:
2021-01-05 11:31:05
阅读次数:
0
介绍 翻译Promises/A+规范的原因在于,在学习Promise时想要了解关于其规范的详细介绍,但是实际搜了很多文章的介绍似乎大多都是"残缺"的,有的文章虽然说是介绍Promises/A+规范,但其实或是简单介绍,或是做一些总结归纳;有的文章是有关Promises/A+规范的翻译,但是个人读起来 ...
分类:
其他好文 时间:
2020-08-25 18:46:09
阅读次数:
68
一、什么是 Promise 1.1 Promise 的前世今生 Promise 最早出现在 1988 年,由 Barbara Liskov、Liuba Shrira 首创(论文:Promises: Linguistic Support for Efficient Asynchronous Proce ...
分类:
其他好文 时间:
2020-07-03 23:26:07
阅读次数:
78
背景 我们在需要保证代码在多个异步处理之后执行,我们通常会使用 Promise.all(promises: []).then(fun: function); Promise.all可以保证,promises数组中所有promise对象都达到resolve状态,才执行then回调 那么会出现的情况是, ...
分类:
其他好文 时间:
2020-06-13 13:16:16
阅读次数:
121
AJAX本质是使用XMLHttpRequest对象请求数据 fetch更简单,第一个是url第二个是参数,采用了Promises来处理结果或者回调 AJAX的步骤? 1、创建XMLHttpRequest对象var xhr = new XMLHttpRequest() 2、与服务器创立连接xhr.op ...
分类:
Web程序 时间:
2020-06-01 00:31:06
阅读次数:
81
async/await https://javascript.info/async-await 需要浏览器支持,后者使用webpack转换为ES5. There’s a special syntax to work with promises in a more comfortable fashio ...
分类:
Web程序 时间:
2020-05-05 20:24:56
阅读次数:
120
The Promise.any() method accepts an array (or any other iterable) of promises as a parameter. It returns a Promise object that is fulfilled with the v ...
分类:
编程语言 时间:
2020-02-20 20:09:40
阅读次数:
69
The Promise.allSettled() method accepts an array (or any other iterable) of promises as a parameter. It returns a Promise object that is fulfilled wit ...
分类:
编程语言 时间:
2020-02-20 18:45:55
阅读次数:
87