Run multiple fetch with limited concurrency
Install and add nuxt-parallel-limit
to your nuxt.config
.
npm install -D nuxt-parallel-limit
yarn add -D nuxt-parallel-limit
pnpm add -D nuxt-parallel-limit
export default defineNuxtConfig({
modules: ['nuxt-parallel-limit'],
})
You can pass configuration to the module in the nuxt.config
like following:
export default defineNuxtConfig({
modules: ['nuxt-parallel-limit'],
parallelLimit: {
patterns: [
{
pattern: 'https://jsonplaceholder.typicode.com',
limit: 2
}
]
},
})
pattern
:
- Type:
string
- Details: The
pattern
specifies a regular expression the fetch url should match. If the fetch url matches the specifiedpattern
, the fetch will be limited by thelimit
attribute.
limit
:
- Type:
number
- Details: Limit the maximum number of concurrent.
- Clone this repository
- Install dependencies using pnpm install
- Stub module with
pnpm dev:prepare
- Run pnpm dev to start playground in development mode
Made with ❤️
Published under the MIT License.