Skip to content

Commit

Permalink
Merge pull request #821 from thefrontside/channel-docs
Browse files Browse the repository at this point in the history
fix channel docs
  • Loading branch information
cowboyd authored Nov 6, 2023
2 parents ff2d173 + 0a6eb1c commit 7c872c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ export interface Channel<T, TClose> extends Stream<T, TClose> {
* 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' }
Expand Down
8 changes: 4 additions & 4 deletions www/docs/collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 7c872c0

Please sign in to comment.