chore: update examples in docs to async/await#542
Conversation
alanshaw
left a comment
There was a problem hiding this comment.
I think it's work putting a comment at the top of every file to say that all the APIs that return Promises also accept a final callback parameter that is not listed in the docs.
Please, next time, multiple PRs 🙏
| const links = await ipfs.object.links(multihash) | ||
| console.log(links) | ||
| // Logs: | ||
| // [] |
There was a problem hiding this comment.
Can you please update this example to include actual content!
There was a problem hiding this comment.
Use a cid that actually has links so that we can demonstrate using the console.log(). Am I right?
SPEC/PUBSUB.md
Outdated
| - `topic: String` | ||
| - `handler: (msg) => {}` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: String, seqno: Buffer, data: Buffer, topicIDs: Array<String>}`. | ||
| - `options: Object` - (Optional) Object containing the following properties: | ||
| - `discover: Boolean` - (Default: `false`) Will use the DHT to find other peers. |
There was a problem hiding this comment.
Please could you please add a comment that this option is currently unimplemented?
There was a problem hiding this comment.
If discover was the only option and it's not implemented yet, it means that currently there are no options available. Right?
There was a problem hiding this comment.
Correct, but please leave this here as we need to document onError asap, which you can pass to the HTTP client for dealing with pubsub errors and disconnections.
Any chance you could send a PR for it?
|
ping @PedroMiguelSS |
d28ea58 to
e87014d
Compare
|
Do you prefer one PR per file/API? @alanshaw |
e87014d to
74f38f4
Compare
74f38f4 to
838bac5
Compare
|
Thanks @PedroMiguelSS ❤️ |
This PR converts
interface-ipfs-coredocs examples to use async/await syntax.Closes #525.