Skip to content

Commit

Permalink
chore: added changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
pluvrt committed May 22, 2024
1 parent 6fb6695 commit 7f5a400
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .changeset/smooth-kings-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@pluv/client": patch
---

Added event proxy as a new way to invoke event procedures.

```ts
// backend

const router = io.router({
SEND_MESSAGE: io.procedure
.input(z.object({ message: z.string() }))
.broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
});

// frontend
const client = createClient(/* ... */);

// Both of the examples below are equivalent.

client.event("RECEIVE_MESSAGE", ({ data }) => {
const { message } = data;

console.log(message);
});

client.event.RECEIVE_MESSAGE(({ data }) => {
const { message } = data;

console.log(message);
});
```

0 comments on commit 7f5a400

Please sign in to comment.