promise-zrk-all

1.1.0 • Public • Published

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)})

Readme

Keywords

Package Sidebar

Install

npm i promise-zrk-all

Weekly Downloads

5

Version

1.1.0

License

ISC

Unpacked Size

2.4 kB

Total Files

3

Last publish

Collaborators

  • zhaoruike