From 0a6eb1c0f9c72738db0c2266bb35869f830fbd38 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 3 Nov 2023 17:59:49 -0500 Subject: [PATCH] fix channel docs The `createChannel()` docs had gotten way out of date. Most of the docs had gotten fixed, but these didn't --- lib/channel.ts | 12 ++++++------ www/docs/collections.mdx | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/channel.ts b/lib/channel.ts index b7ad33a13..7d7eac5f3 100644 --- a/lib/channel.ts +++ b/lib/channel.ts @@ -35,15 +35,15 @@ export interface Channel extends Stream { * import { main, createChannel } from 'effection'; * * await main(function*() { - * let { input, output } = createChannel(); + * let channel = createChannel(); * - * yield* input.send('too early'); // the channel has no subscribers yet! + * yield* channel.send('too early'); // the channel has no subscribers yet! * - * let subscription1 = yield* channel; - * let subscription2 = yield* channel; + * let subscription1 = yield* channel.subscribe(); + * let subscription2 = yield* channel.subscribe(); * - * yield* input.send('hello'); - * yield* input.send('world'); + * yield* channel.send('hello'); + * yield* channel.send('world'); * * console.log(yield* subscription1.next()); //=> { done: false, value: 'hello' } * console.log(yield* subscription1.next()); //=> { done: false, value: 'world' } diff --git a/www/docs/collections.mdx b/www/docs/collections.mdx index b6ac0d06b..8f1581b82 100644 --- a/www/docs/collections.mdx +++ b/www/docs/collections.mdx @@ -77,13 +77,13 @@ to show the difference between them: import { main, createChannel } from 'effection'; await main(function*() { - let { send, subscribe} = createChannel(); + let channel = createChannel(); // the channel has no subscribers yet! - yield* send('too early'); + yield* channel.send('too early'); - let subscription1 = yield* subscribe(); - let subscription2 = yield* subscribe(); + let subscription1 = yield* channel.subscribe(); + let subscription2 = yield* channel.subscribe(); yield* send('hello'); yield* send('world');