From 9befa48a7aea5f44410f0b49002cbb59c31a0f8d Mon Sep 17 00:00:00 2001 From: Hayden Young Date: Sat, 24 Jun 2023 23:50:44 +0100 Subject: [PATCH] docs: Formatting. --- src/database.js | 9 +++++++++ src/db/documents.js | 4 ++-- src/sync.js | 12 ++++++------ test/orbit-db-address.test.js | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/database.js b/src/database.js index 2dc0000..dc853d2 100644 --- a/src/database.js +++ b/src/database.js @@ -91,6 +91,15 @@ const Database = async ({ ipfs, identity, address, name, access, directory, meta const log = await Log(identity, { logId: address, access, entryStorage, headsStorage, indexStorage }) + /** + * Event emitter that emits Database changes. + * @†ype EventEmitter + * @fires update when addOperation or applyOperation completes. + * @fires close when the database is successfully closed. + * @fires drop when the database is successfully dropped. + * @memberof module:Sync~Sync + * @instance + */ const events = new EventEmitter() const queue = new PQueue({ concurrency: 1 }) diff --git a/src/db/documents.js b/src/db/documents.js index b849fea..5a98044 100644 --- a/src/db/documents.js +++ b/src/db/documents.js @@ -83,8 +83,8 @@ const Documents = ({ indexBy } = DefaultOptions) => async ({ ipfs, identity, add * @function * @param {function(Object)} findFn A function for querying for specific * results. - * - * The findFn function's signature takes the form `function(doc)` where doc + * + * The findFn function's signature takes the form `function(doc)` where doc * is a document's value property. The function should return true if the * document is found, false otherwise. * @return {Array} Found documents. diff --git a/src/sync.js b/src/sync.js index 984cf9b..86ca1ee 100644 --- a/src/sync.js +++ b/src/sync.js @@ -81,7 +81,7 @@ const Sync = async ({ ipfs, log, events, onSynced, start, timeout }) => { /** * Callback function when new heads have been received from other peers. - * @callback module:Sync~onSynced + * @callback module:Sync~Sync#onSynced * @param {PeerID} peerId PeerID of the peer who we received heads from * @param {Entry[]} heads An array of Log entries */ @@ -130,12 +130,12 @@ const Sync = async ({ ipfs, log, events, onSynced, start, timeout }) => { const peers = new Set() /** - * Event emitter that emits updates. - * @name events + * Event emitter that emits Sync changes. * @†ype EventEmitter - * @fires join when a peer has connected and heads were exchanged - * @fires leave when a peer disconnects - * @fires error when an error occurs + * @fires module:Sync~Sync#join when a peer has connected and heads are + * exchanged + * @fires module:Sync~Sync#leave when a peer disconnects + * @fires module:Sync~Sync#error when an error occurs * @memberof module:Sync~Sync * @instance */ diff --git a/test/orbit-db-address.test.js b/test/orbit-db-address.test.js index 8430689..e72bbd5 100644 --- a/test/orbit-db-address.test.js +++ b/test/orbit-db-address.test.js @@ -1,5 +1,5 @@ import { strictEqual, notStrictEqual, deepStrictEqual } from 'assert' -import { default as OrbitDBAddress, isValidAddress, parseAddress } from '../src/address.js' +import OrbitDBAddress, { isValidAddress, parseAddress } from '../src/address.js' describe('Address', function () { describe('Creating an address from full address string', () => {