43 lines
1.8 KiB
Markdown
43 lines
1.8 KiB
Markdown
# round-robin-scheduler
|
|
|
|
**A [round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) [scheduler](https://en.wikipedia.org/wiki/Scheduling_(computing)), compatible with the [`abstract-scheduler` interface](https://www.npmjs.com/package/abstract-scheduler).**
|
|
|
|
[](https://github.com/derhuerst/abstract-scheduler)
|
|
|
|
[](https://www.npmjs.com/package/@derhuerst/round-robin-scheduler)
|
|
[](https://travis-ci.org/derhuerst/round-robin-scheduler)
|
|

|
|
[](https://gitter.im/derhuerst)
|
|
[](https://patreon.com/derhuerst)
|
|
|
|
|
|
## Installation
|
|
|
|
```shell
|
|
npm install @derhuerst/round-robin-scheduler
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const createRoundRobin = require('@derhuerst/round-robin-scheduler')
|
|
|
|
const roundRobin = createRoundRobin(['foo', 'bar'])
|
|
|
|
roundRobin.get() // foo
|
|
roundRobin.get() // bar
|
|
roundRobin.add('baz') // 2
|
|
roundRobin.length // 3
|
|
roundRobin.get() // baz
|
|
roundRobin.remove(0) // remove first item
|
|
roundRobin.get() // bar
|
|
```
|
|
|
|
`roundRobin` is compatible with the [`abstract-scheduler` interface](https://www.npmjs.com/package/abstract-scheduler).
|
|
|
|
|
|
## Contributing
|
|
|
|
If you have a question or need support using `round-robin-scheduler`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/round-robin-scheduler/issues).
|