From a24fafd5703a4e999552d34b49992b2299acf0f4 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 10 Dec 2020 12:32:34 +0100 Subject: [PATCH] chore: make metadata optional on addStream --- src/connection/connection.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/connection/connection.js b/src/connection/connection.js index 9ce6dca..7427917 100644 --- a/src/connection/connection.js +++ b/src/connection/connection.js @@ -33,6 +33,10 @@ const connectionSymbol = Symbol.for('@libp2p/interface-connection/connection') * @property {() => Promise} close - close raw connection function. * @property {() => MuxedStream[]} getStreams - get streams from muxer function. * @property {ConectionStat} stat - metadata of the connection. + * + * @typedef {Object} StreamData + * @property {string} protocol - the protocol used by the stream + * @property {Object} [metadata] - metadata of the stream */ /** @@ -180,9 +184,7 @@ class Connection { * Add a stream when it is opened to the registry. * * @param {MuxedStream} muxedStream - a muxed stream - * @param {object} properties - the stream properties to be registered - * @param {string} properties.protocol - the protocol used by the stream - * @param {object} [properties.metadata] - metadata of the stream + * @param {StreamData} data - the stream data to be registered * @returns {void} */ addStream (muxedStream, { protocol, metadata = {} }) {