Installation
Using npm: ``npm install poll-js
``Using yarn: ``
yarn add poll-js
``Usage
```$xsltimport { pollWrapper } from 'poll-js';
const { future, cancel } = pollWrapper({ request: fetch('github.com'), pollingPeriod: 1000 // ms, shouldStop: response => response.status === 200 });
future .then(response => {...}) .catch(error => {...})
// If by some reason you want to abort polling cancel();
```
API
.pollWrapper({request, pollingPeriod, shouldStop})
ReturnsPromise
and cancel
function. cancel
allows manually terminate polling.