Skip to content

Commit

Permalink
return the StreamClient from StreamClient.start so we can chain it
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpaterson committed Mar 5, 2024
1 parent ae1f6e5 commit ab13765
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ export class StreamClient {
this.#httpStreamClient = httpStreamClient;
}

start(onEvent: StreamEventHandler, onFatalError: (error: Error) => void) {
start(
onEvent: StreamEventHandler,
onFatalError: (error: Error) => void
): StreamClient {
const run = async () => {
try {
for await (const event of this) {
Expand All @@ -656,6 +659,7 @@ export class StreamClient {
}
};
run();
return this;
}

async *[Symbol.asyncIterator](): AsyncGenerator<StreamEvent> {
Expand Down

0 comments on commit ab13765

Please sign in to comment.