Skip to content
/ retry Public

Exponentially retry a function in JavaScript

License

Notifications You must be signed in to change notification settings

maraisr/retry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retry licenses

A tiny utility for exponentially retrying



This is free to use software, but if you do like it, consider supporting me ❤️

sponsor me buy me a coffee

⚙️ Install

🚀 Usage

import { retry } from 'rtri';

const get_data = await retry(
	async () => {
		const response = await fetch('https://example.com');
		if (!response.ok) throw new Error('not ok');
		return response.json();
	},
	{ attempts: 3 },
);

await get_data();

License

MIT © Marais Rossouw

About

Exponentially retry a function in JavaScript

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project