DJWassink / Promise-parallel-throttle

It's kinda like Promise.all(), but throttled!
MIT License
81 stars 3 forks source link

Use object notation instead of arguments #15

Closed monolithed closed 7 years ago

monolithed commented 7 years ago

Before:

Throttle.all(tasks, maxInProgress = DEFAULT_MAX, failFast = true, progressCallback, nextCheck = defaultNextTaskCheck)

After:

Throttle.all(tasks, progressCallback, {
      maxInProgress: DEFAULT_MAX, 
      failFast: true, 
      nextCheck: defaultNextTaskCheck
})

It's just a proposal

DJWassink commented 7 years ago

The current API could definitely use some refactoring since there are a lot arguments right now.

Let me think about it for a bit, I will definitely get back to this!

DJWassink commented 7 years ago

v3.0.0 introduces a new API which looks like:

Throttle.all(tasks, {
      maxInProgress: DEFAULT_MAX, 
      failFast: true,
      nextCheck: defaultNextTaskCheck,
      progressCallback: null
})

Cheers! 🎉