mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 14:50:03 -04:00
add a synchronous example
This commit is contained in:
parent
8015428b45
commit
7bd51538c8
1 changed files with 10 additions and 0 deletions
10
README.md
10
README.md
|
@ -64,3 +64,13 @@ const port = await connection.getInnerPort();
|
|||
// ... transfer it to worker ...
|
||||
const client = new BareClient(port);
|
||||
```
|
||||
```js
|
||||
// doing this synchronously
|
||||
const connection = new Ultraviolet.BareMuxConnection();
|
||||
let port;
|
||||
connection.getInnerPort().then((MessagePort) => {
|
||||
port = MessagePort;
|
||||
});
|
||||
// ... transfer it to worker ...
|
||||
this.bareClient = new BareClient(port)
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue