Skip to main content
Version: 3.x

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

NameTypeDescription
event_namestringThe name of the event
created_atDateThe date of the event
payloadobjectThe payload of the event
metadataobjectThe metadata of the event