https://github.com/afeiship/next-loop-execute
Loop execute for next.
https://github.com/afeiship/next-loop-execute
action execute fetch loop next
Last synced: 7 days ago
JSON representation
Loop execute for next.
- Host: GitHub
- URL: https://github.com/afeiship/next-loop-execute
- Owner: afeiship
- License: mit
- Created: 2020-07-08T03:10:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-04T08:11:16.000Z (about 1 year ago)
- Last Synced: 2025-10-02T07:54:25.032Z (5 months ago)
- Topics: action, execute, fetch, loop, next
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-loop-execute
> Loop execute for next.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
npm install -S @jswork/next-loop-execute
```
## usage
```js
import '@jswork/next-loop-execute';
const fetchApi = function ({ count }) {
return fetch('https://api.github.com/users/afeiship').then(res=>res.json());
}
// loop 3 times:
nx.loopExecute({
interval: 200,
timeout: 10 * 1000,
interrupt: (res)=>{
return manualInterruptFlag;
},
callback: (data) => {
console.log(data);
return fetch('https://api.github.com/users/afeiship').then((res) => res.json());
},
done: (res) => {
return res.data.status === 'FINISHED';
}
}).then((res) => {
console.log('DONE:', res);
})
```
## license
Code released under [the MIT license](https://github.com/afeiship/next-loop-execute/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/next-loop-execute
[version-url]: https://npmjs.org/package/@jswork/next-loop-execute
[license-image]: https://img.shields.io/npm/l/@jswork/next-loop-execute
[license-url]: https://github.com/afeiship/next-loop-execute/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-loop-execute
[size-url]: https://github.com/afeiship/next-loop-execute/blob/master/dist/next-loop-execute.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/next-loop-execute
[download-url]: https://www.npmjs.com/package/@jswork/next-loop-execute