logo
  • 教程列表
  • SO官方文檔
  • Promise.all
    • 等待兩件事發生
  1. StackOverflow 文件
  2. bluebird 教程
  3. Promise.all
  4. 等待兩件事發生

等待兩件事發生

Created: November-22, 2018

var firstItem = fetch("/api1").then(x => x.json());
var secondItem = fetch("/api2").then(x => x.json());
Promise.all([firstItem, secondItem]).spread((first, second) => {
  // access both results here, both requests completed at this point
});
  • Promise.all

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明