From 9d639eeaaabe0fca1f898c3e76bfe8fbc77deb16 Mon Sep 17 00:00:00 2001 From: phillmac Date: Thu, 19 Sep 2019 19:18:16 +1000 Subject: [PATCH 1/3] Add doc for `peer` event --- API.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/API.md b/API.md index 33cbbfd..8a84a0e 100644 --- a/API.md +++ b/API.md @@ -62,6 +62,7 @@ Read the **[GETTING STARTED](https://github.com/orbitdb/orbit-db/blob/master/GUI + [`load.progress`](#loadprogress) * [`ready`](#ready) * [`write`](#write) + * [`peer`](#peer) * [`closed`](#closed) @@ -603,6 +604,13 @@ db.events.on('write', (dbname, hash, entry) => ... ) Emitted after an entry was added locally to the database. *hash* is the IPFS hash of the latest state of the database. *entry* is the added database op. +### `peer` +```javascript +db.events.on('peer', (peer) => ... ) +``` + +Emitted when a new peer connects via ipfs pubsub. *peer* is the new peer, an instance of [`peerInfo`](https://github.com/libp2p/js-peer-info) + ### `closed` Emitted once the database has finished closing. ```javascript From d800e5d81787ba8940305c92970497cbed8fbc73 Mon Sep 17 00:00:00 2001 From: phillmac Date: Fri, 20 Sep 2019 08:01:57 +1000 Subject: [PATCH 2/3] Fix inaccuracy --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 8a84a0e..2f5a3b5 100644 --- a/API.md +++ b/API.md @@ -609,7 +609,7 @@ Emitted after an entry was added locally to the database. *hash* is the IPFS has db.events.on('peer', (peer) => ... ) ``` -Emitted when a new peer connects via ipfs pubsub. *peer* is the new peer, an instance of [`peerInfo`](https://github.com/libp2p/js-peer-info) +Emitted when a new peer connects via ipfs pubsub. *peer* is a string containing the new peer's id ### `closed` Emitted once the database has finished closing. From 77eb2295549568cef565f3c6dae0f8d4e7628f1f Mon Sep 17 00:00:00 2001 From: phillmac Date: Fri, 20 Sep 2019 08:02:47 +1000 Subject: [PATCH 3/3] Simplify wording --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 2f5a3b5..a5f1036 100644 --- a/API.md +++ b/API.md @@ -609,7 +609,7 @@ Emitted after an entry was added locally to the database. *hash* is the IPFS has db.events.on('peer', (peer) => ... ) ``` -Emitted when a new peer connects via ipfs pubsub. *peer* is a string containing the new peer's id +Emitted when a new peer connects via ipfs pubsub. *peer* is a string containing the id of the new peer ### `closed` Emitted once the database has finished closing.