From f07bf119e7aa451cce2e48f18ca87586ce51183b Mon Sep 17 00:00:00 2001 From: Hugo Josefson Date: Sun, 25 Jun 2023 23:54:30 +0200 Subject: [PATCH] chore: rename to websocket_broadcastchannel --- README.md | 29 +++++++++++++++++++---------- deno.json | 2 +- readme/README.md | 22 +++++++++++++++------- readme/chat.ts | 5 +++-- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d718933..9144403 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ for Deno, that uses [WebSocket](https://developer.mozilla.org/docs/Web/API/WebSocket)s to communicate between processes on the same host. -[![deno.land/x/websocket-broadcastchannel](https://shield.deno.dev/x/websocket-broadcastchannel)](https://deno.land/x/websocket-broadcastchannel) +[![deno.land/x/websocket_broadcastchannel](https://shield.deno.dev/x/websocket_broadcastchannel)](https://deno.land/x/websocket_broadcastchannel) [![CI](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml/badge.svg)](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml) While @@ -22,13 +22,21 @@ Requires a recent version of [Deno](https://deno.land/). ## API -Please see the -[auto-generated API documentation](https://deno.land/x/websocket-broadcastchannel?doc). +Please see MDN's documentation of the +[BroadcastChannel API](https://developer.mozilla.org/docs/Web/API/BroadcastChannel). + +For specifics on what's `export`ed from this module, see our +[auto-generated API documentation](https://deno.land/x/websocket_broadcastchannel?doc). ## Example usage -An example chat application, where each client is a separate process, and the -server is a separate process: +An example chat application, that you can run in several terminals on the same +host, and see the messages broadcast between them. + +This uses the +[createBroadcastChannel](https://deno.land/x/websocket_broadcastchannel?doc#createbroadcastchannel) +function to create the relevant `BroadcastChannel` object, and then uses the +`BroadcastChannel` API as usual. ```typescript import { @@ -37,7 +45,7 @@ import { Logger, logger, WebSocketBroadcastChannel, -} from "https://deno.land/x/websocket-broadcastchannel/mod.ts"; +} from "https://deno.land/x/websocket_broadcastchannel/mod.ts"; const log: Logger = logger(import.meta.url); /** @@ -70,8 +78,9 @@ the others will take over that duty, and the rest will reconnect to it. Running on Deno Deploy. Application-wide BroadcastChannel is fully supported, so you don't need WebSocketBroadcastChannel! -(It makes little sense to use stdin on Deno Deploy, so this example is only -useful on Deno Deploy, for seeing this detection in your logs :) +(However, it makes little sense to read from stdin on Deno Deploy, so this +example CLI-based chat app is only useful on Deno Deploy, for seeing this +detection in your logs :) =============================================================================== `); } @@ -114,11 +123,11 @@ if (import.meta.main) { To run the above example: ```sh -deno run --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts +deno run --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts ``` If you want to see all the debug output: ```sh -DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts +DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts ``` diff --git a/deno.json b/deno.json index 231c23f..aa9a0c3 100644 --- a/deno.json +++ b/deno.json @@ -4,7 +4,7 @@ "all-reload": "deno fmt && deno lint && deno task check --reload && deno task test --reload", "check": "sh -c '$(command -v fd || command -v fdfind) '\"'\"'\\.(mj|j|t)sx?$'\"'\"' --hidden --exec deno check {}'", "test": "deno test --allow-run --allow-env=VERBOSE", - "readme": "touch README.md && chmod +w README.md && ./readme/generate-readme.ts readme/README.md https://deno.land/x/websocket-broadcastchannel > README.md && deno fmt README.md && chmod -w README.md", + "readme": "touch README.md && chmod +w README.md && ./readme/generate-readme.ts readme/README.md https://deno.land/x/websocket_broadcastchannel > README.md && deno fmt README.md && chmod -w README.md", "readme-html": "deno task readme && sh -c 'docker run --rm -i hugojosefson/markdown README.html'", "release": "deno task all && test -z \"$(git status --porcelain)\" && GITHUB_TOKEN=$(gh auth token) deno run --allow-env=GITHUB_TOKEN --allow-net=api.github.com --allow-run=bash https://deno.land/x/shipit@0.6.1/shipit.ts", "udd": "sh -c 'deno run --allow-read=. --allow-write=. --allow-net --allow-run=deno https://deno.land/x/udd@0.8.2/main.ts --test \"deno task all\" $($(command -v fd || command -v fdfind) '\"'\"'(\\.(mj|j|t)sx?|^deno.jsonc?)$'\"'\"')'" diff --git a/readme/README.md b/readme/README.md index c685a2c..4d5aeb6 100644 --- a/readme/README.md +++ b/readme/README.md @@ -6,7 +6,7 @@ for Deno, that uses [WebSocket](https://developer.mozilla.org/docs/Web/API/WebSocket)s to communicate between processes on the same host. -[![deno.land/x/websocket-broadcastchannel](https://shield.deno.dev/x/websocket-broadcastchannel)](https://deno.land/x/websocket-broadcastchannel) +[![deno.land/x/websocket_broadcastchannel](https://shield.deno.dev/x/websocket_broadcastchannel)](https://deno.land/x/websocket_broadcastchannel) [![CI](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml/badge.svg)](https://github.com/hugojosefson/deno-websocket-broadcastchannel/actions/workflows/ci.yaml) While @@ -22,13 +22,21 @@ Requires a recent version of [Deno](https://deno.land/). ## API -Please see the -[auto-generated API documentation](https://deno.land/x/websocket-broadcastchannel?doc). +Please see MDN's documentation of the +[BroadcastChannel API](https://developer.mozilla.org/docs/Web/API/BroadcastChannel). + +For specifics on what's `export`ed from this module, see our +[auto-generated API documentation](https://deno.land/x/websocket_broadcastchannel?doc). ## Example usage -An example chat application, where each client is a separate process, and the -server is a separate process: +An example chat application, that you can run in several terminals on the same +host, and see the messages broadcast between them. + +This uses the +[createBroadcastChannel](https://deno.land/x/websocket_broadcastchannel?doc#createbroadcastchannel) +function to create the relevant `BroadcastChannel` object, and then uses the +`BroadcastChannel` API as usual. ```typescript "@@include(./chat.ts)"; @@ -37,11 +45,11 @@ server is a separate process: To run the above example: ```sh -deno run --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts +deno run --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts ``` If you want to see all the debug output: ```sh -DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket-broadcastchannel/readme/chat.ts +DEBUG='*' deno run --allow-env=DEBUG --reload --allow-net https://deno.land/x/websocket_broadcastchannel/readme/chat.ts ``` diff --git a/readme/chat.ts b/readme/chat.ts index f83a626..6146601 100755 --- a/readme/chat.ts +++ b/readme/chat.ts @@ -38,8 +38,9 @@ the others will take over that duty, and the rest will reconnect to it. Running on Deno Deploy. Application-wide BroadcastChannel is fully supported, so you don't need WebSocketBroadcastChannel! -(It makes little sense to use stdin on Deno Deploy, so this example is only -useful on Deno Deploy, for seeing this detection in your logs :) +(However, it makes little sense to read from stdin on Deno Deploy, so this +example CLI-based chat app is only useful on Deno Deploy, for seeing this +detection in your logs :) =============================================================================== `); }