-
Notifications
You must be signed in to change notification settings - Fork 105
chore: update examples in docs to async/await #542
Conversation
alanshaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update this example to include actual content!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you please add a comment that this option is currently unimplemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.