https://github.com/evangilo/polling-js
https://github.com/evangilo/polling-js
poll polling
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/evangilo/polling-js
- Owner: evangilo
- Created: 2020-06-18T15:53:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T09:19:21.000Z (over 2 years ago)
- Last Synced: 2025-03-18T12:12:45.781Z (about 1 month ago)
- Topics: poll, polling
- Language: TypeScript
- Size: 709 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Polling.js
## Installation
`npm install polling-js`
## Usage
```javascript
import { setPolling } from 'polling-js';const fetchUserData = (signal) => {
return fetch('https://api.randomuser.me/', {signal})
.then(response => response.json())
.then(user => console.log(user));
};const cancelPolling = setPolling(fetchUserData, 1000, new AbortController());
setTimeout(cancelPolling, 10000);
```## License
MIT