ServerEvent
The `ServerEvent` class defines the format used in Front-Commerce to publish events to the server event pipeline.
Usage:
import { ServerEvent } from "@front-commerce/core/events";
type MyEventPayload = {
sku: string;
price: boolean;
};
export default class MyEvent extends ServerEvent<MyEventPayload> {
constructor(sku: string, price: number, shopId: string) {
super("MyEvent", new Date(), { sku, price }, { shopId });
}
}
Arguments
Name | Type | Description |
---|---|---|
event_name | string | The name of the event |
created_at | Date | The date of the event |
payload | object | The payload of the event |
metadata | object | The metadata of the event |