flush promises:刷新所有排队的已解决promise处理程序 源码
同花顺 刷新所有未解决的已解决的Promise处理程序。 在测试中有用。 异步/等待的示例 const flushPromises = require ( 'flush-promises' ) ; test ( 'flushPromises' , async ( ) => { let a ; let b ; Promise . resolve ( ) . then ( ( ) => { a = 1 ; } ) . then ( ( ) => { b = 2 ; } ) await flushPromises ( ) ; expect ( a ) .
下载地址
用户评论