Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I add delay? #25

Closed
dilipkumar2k6 opened this issue Oct 23, 2019 · 1 comment
Closed

How can I add delay? #25

dilipkumar2k6 opened this issue Oct 23, 2019 · 1 comment

Comments

@dilipkumar2k6
Copy link

Between two consecutive call, I would like to add delay, is it possible?

@sindresorhus
Copy link
Owner

The mapper waits for a promise/async-function, so you can use https://github.com/sindresorhus/delay in there.

(async () => {
	const mapper = async element => {
		// something here

		await delay(1000);

		// something here
	};

 	const result = await pMap(array, mapper, {concurrency: 2});
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants