From 0dbf1335369470844283b73f057a8d8ddbb9c1d5 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 23 May 2019 10:05:40 +0100 Subject: [PATCH] docs: add documentation for ready promise License: MIT Signed-off-by: Alan Shaw --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 658a8cb668..973b7fd0d6 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ We've come a long way, but this project is still in Alpha, lots of development i - [API Docs](#api) - [Constructor](#ipfs-constructor) - [Events](#events) + - [ready](#nodeready) - [start](#nodestart) - [stop](#nodestop) - [Core API](#core-api) @@ -541,6 +542,16 @@ node.on('error', errorObject => console.error(errorObject)) - `stop` is emitted when a node has closed all connections and released access to its repo. This is usually the result of calling [`node.stop()`](#nodestop). +#### `node.ready` + +A promise that resolves when the node is ready to use. Should be used when constructing an IPFS node using `new`. You don't need to use this if you're using [`await IPFS.create`](#ipfs-constructor). e.g. + +```js +const node = new IPFS() +await node.ready +// Ready to use! +``` + #### `node.start()` Start listening for connections with other IPFS nodes on the network. In most cases, you do not need to call this method — `IPFS.create()` will automatically do it for you.