From d8cb660edfc02e1b8c4d67a876d754ce90bfbc92 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 6b8376f..57d7bf7 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,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).