From 6dfa4f32caed7b0b99f1c3a959e2790f0b896de0 Mon Sep 17 00:00:00 2001 From: Nina Breznik Date: Mon, 6 Feb 2023 17:43:05 +0000 Subject: [PATCH] update readme with mux.pair and mux.opened (#9) * update readme with mux.pair and mux.opened * add opts to .pair, .unpair and .opened --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e47d55..b5ca71e 100644 --- a/README.md +++ b/README.md @@ -108,13 +108,25 @@ __NOTE__: `mux.createChannel` returns `null` if the channel should not be opened If you want multiple sessions with the same `protocol` and `id`, set `unique: false` as an option. +#### `const opened = mux.opened({ protocol, id })` + +Boolean that indicates if the channel is opened. + +#### `mux.pair({ protocol, id }, callback)` + +Register a callback to be called everytime a new channel is requested. + +#### `mux.unpair({ protocol, id })` + +Unregisters the pair callback. + #### `channel.open([handshake])` Open the channel. #### `const m = channel.addMessage(opts)` -Add a message. Options include: +Add/register a message type for a certain encoding. Options include: ``` js {