Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update events.md to include reference to createEventBuilder #3526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion www/docs/events.md
Expand Up @@ -60,14 +60,23 @@ In your application you can define events. This definition provides validation u


```ts title="packages/core/src/todo.ts"
import { event } from "./events";
import { createEventBuilder } from "sst/node/event-bus";

const event = createEventBuilder({
bus: "bus",
});

export const Events = {
Created: event("todo.created", {
id: z.string(),
}),
};
```

:::info
Note that the `"bus"` string passed to the `createEventBuilder` is the same ID as provided in the EventBus construct in MyStack.ts above
:::

---

## Define subscriber
Expand Down