https://github.com/little-core-labs/hypercore-ready
Wait for 1 more or more hypercores to be ready.
https://github.com/little-core-labs/hypercore-ready
callback hypercore ready
Last synced: 6 months ago
JSON representation
Wait for 1 more or more hypercores to be ready.
- Host: GitHub
- URL: https://github.com/little-core-labs/hypercore-ready
- Owner: little-core-labs
- License: mit
- Created: 2019-09-30T22:38:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-01T18:58:06.000Z (about 6 years ago)
- Last Synced: 2024-10-16T09:01:52.876Z (about 1 year ago)
- Topics: callback, hypercore, ready
- Language: JavaScript
- Size: 7.81 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hypercore-ready
===============
> Wait for 1 more or more hypercores to be ready.
## Installation
```sh
$ npm install hypercore-ready --save
```
## Usage
```js
const ready = require('hypercore-ready')
ready(...hypercores, (err) => {
// called when all hypercores are ready
})
```
## API
### `ready(...hypercores[, callback])`
### `ready(hypercores[, callback])`
### `await ready(hypercores)`
Waits for all given `hypercores` to be ready calling `callback(err,
pending, total)` when all are ready or when an error occurs.
```js
const cores = [ ...hypercores ]
ready(...cores, callback)
// or
ready(cores)
// or
await ready(cores)
```
## License
MIT