You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: www/apps/book/app/advanced-development/events-and-subscribers/data-payload/page.mdx
+7-7
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,12 @@ In this chapter, you'll learn how subscribers receive an event's data payload.
12
12
13
13
When events are emitted, they’re emitted with a data payload.
14
14
15
-
The object that the subscriber function receives as a parameter has a `data` property, which is an object holding the event payload with additional context.
15
+
The object that the subscriber function receives as a parameter has an `event` property, which is an object holding the event payload in a `data` property with additional context.
16
16
17
17
For example:
18
18
19
19
exportconst highlights = [
20
-
["7", "", "The event's data payload."],
20
+
["7", "event", "The event details."],
21
21
["8", "{ id: string }", "The type of expected data payloads."],
22
22
]
23
23
@@ -28,9 +28,9 @@ import type {
28
28
} from"@medusajs/medusa"
29
29
30
30
exportdefaultasyncfunction productCreateHandler({
31
-
data,
31
+
event,
32
32
}:SubscriberArgs<{ id:string }>) {
33
-
const productId =data.data.id
33
+
const productId =event.data.id
34
34
console.log(`The product ${productId} was created`)
0 commit comments