1.1.0 • Published 6 years ago

promise-zrk-all v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

promiseAll

New method for promise-zrkAll(promiseList,errNum). promiseList:p1,p2,p3.... Array, errNum:1 Number.

demo

  let p1= new Promise(function(res,rej){setTimeout(function(){res(1)},1000)})
  let p2= new Promise(function(res,rej){setTimeout(function(){rej(2)}),2000})
  let p3= new Promise(function(res,rej){setTimeout(function(){rej(3)}),3000})
  let p4= new Promise(function(res,rej){setTimeout(function(){rej(4)},1000)})
  let p5= new Promise(function(res,rej){setTimeout(function(){res(5)},1000)})
  let p6= new Promise(function(res,rej){setTimeout(function(){res(6)},1000)})

  Promise.zrkAll([p1,p2,p3,p4,p5,p6],2).then(function(data){console.log(data)}).catch(function(err){console.log(err)})

  Promise.zrkAll([p1,p2,p3,p4,p5,p6],4).then(function(data){console.log(data)}).catch(function(err){console.log(err)})