From e5897e3098964f32c824e862e774040e6291e56f Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 9 May 2019 16:17:42 +0100 Subject: [PATCH] docs: add example for onStream as prop --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c5eab44..59bd9e0 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,12 @@ pipe(conn, muxer, conn) // conn is duplex connection to another peer Use this property as an alternative to passing `onStream` as an option to the `Muxer` constructor. +```js +const muxer = new Muxer() +// ...later +muxer.onStream = stream => { /* ... */ } +``` + #### `const stream = muxer.newStream([options])` Initiate a new stream with the remote. Returns a [duplex stream](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it).