Skip to content

Creates a request interval with initial timeout and number of intervals.

License

Notifications You must be signed in to change notification settings

webiya/request-pinger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

request-pinger

Creates a request interval with initial timeout and number of intervals.

Installation

npm install request-pinger

or

yarn add request-pinger

Usage Example

import pinger from 'request-pinger';

setLoading = state => console.log(`loading: ${state}`);

const request = async () => {
  const data = await fetch('http://example.com/movies.json')
    .then(response => {
      return response;
    })
    .catch(error => error);

  console.log(data);
};

initialWait = 500; // in milliseconds
intervalWait = 1000; // in milliseconds
initialCounter = 5;

pinger(initialWait, intervalWait, initialCounter, request, setLoading);

About

Creates a request interval with initial timeout and number of intervals.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published