From 072994797e04d15070c058580c3f2b09adf0a828 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 4 Nov 2024 20:59:22 +0000 Subject: [PATCH] Fix a typo in the README (#11) --- CHANGELOG.md | 4 ++++ README.md | 21 +++++++++++++++------ package.json | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ccab4b..7ad0c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.3 + +* No user-visible changes. + ## 1.1.2 * No user-visible changes. diff --git a/README.md b/README.md index ee85232..30adbc8 100644 --- a/README.md +++ b/README.md @@ -12,23 +12,32 @@ action. [the `sync-child-process` package]: https://github.com/sass/sync-child-process +[**API Docs**] + +[**API Docs**]: https://sass.github.io/sync-message-port/classes/SyncMessagePort.html + ## Usage -1. Use `SyncMessagePort.createChanenl()` to create a message channel that's set - up to be compatible with `SyncMessagePort`s. A normal `MessageChannel` won't - work! +1. Use [`SyncMessagePort.createChannel()`] to create a message channel that's + set up to be compatible with `SyncMessagePort`s. A normal `MessageChannel` + won't work! 2. You can send this `MessageChannel`'s ports across worker boundaries just like any other `MessagePort`. Send one to the worker you want to communicate with synchronously. 3. Once you're ready to start sending and receiving messages, wrap *both* ports - in `new SyncMessagePort()`, even if one is only ever going to be sending + in [`new SyncMessagePort()`], even if one is only ever going to be sending messages and not receiving them. -4. Use `SyncMessagePort.postMessage()` to send messages and +4. Use [`SyncMessagePort.postMessage()`] to send messages and `SyncMessagePort.receiveMessage()` to receive them synchronously. +[`SyncMessagePort.createChannel()`]: https://sass.github.io/sync-message-port/classes/SyncMessagePort.html#createChannel +[`new SyncMessagePort()`]: https://sass.github.io/sync-message-port/classes/SyncMessagePort.html#constructor +[`SyncMessagePort.postMessage()`]: https://sass.github.io/sync-message-port/classes/SyncMessagePort.html#postMessage +[`SyncMessagePort.receiveMessage()`]: https://sass.github.io/sync-message-port/classes/SyncMessagePort.html#receiveMessage + ```js import {Worker} from 'node:worker_threads'; import {SyncMessagePort} from 'sync-message-port; @@ -111,7 +120,7 @@ across threads when messages are available, and [`Atomics`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer -[`Worker.receiveMessageOnPort()`]: https://nodejs.org/api/worker_threads.html#workerreceivemessageonportport +[`worker_threads.receiveMessageOnPort()`]: https://nodejs.org/api/worker_threads.html#workerreceivemessageonportport ### Can I use this in a browser? diff --git a/package.json b/package.json index 7b87459..4683e44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sync-message-port", - "version": "1.1.2", + "version": "1.1.3", "description": "A Node.js communication port that can pass messages synchronously between workers", "repository": "sass/sync-message-port", "author": "Google Inc.",