Advertisement
tenchus

JS promise

Jun 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function pressbutton() {
  2.     Promise.all([
  3.         fetch("../data/lim-2018-03-pre-core-pw/users.json"),
  4.         fetch("../data/lim-2018-03-pre-core-pw/progress.json"),
  5.         fetch("../data/cohorts.json")        
  6.     ]).then(
  7.         (DatosJsons) =>{
  8.             return Promise.all(DatosJsons.map((Respuesta)=>{
  9.                 return Respuesta.json();
  10.             }))
  11.         }
  12.     ).then(
  13.         (RespuestaJson) => {
  14.             //computeUsersStats(RespuestaJson[0],RespuestaJson[1],RespuestaJson[2]);
  15.             console.log(RespuestaJson[0]);
  16.             console.log(RespuestaJson[1]);
  17.             console.log(RespuestaJson[2]);
  18.         }
  19.     )
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement