When you generate an event extension, the CLI adds the following files to your project:
<your-event>.extension.ts: Builds the event.<your-event>.ts: Defines the event handler logic.The <your-event>.extension.ts file contains an event extension's builder configuration.
The event builder is defined using the following schema, shown here as a TypeScript type:
Here's an example builder definition:
The following fields can be used in the configuration object:
| Field | Type | Description |
|---|---|---|
id | string | Event extension ID as a (GUID). The ID is automatically generated and must be unique across all extensions in the project. |
source | string | Path to the event handler file that contains the event logic. |
Important: You can't have 2 event extensions listening to the same event in your project. Each event can only have one handler.
The <your-event>.ts file contains an event extension's handler logic.
This file contains:
The generated <your-event>.ts file will contain example code for an event.
The <your-event>.ts file must be in the following format:
Here's an example my-event.ts file for the Wix CRM onContactCreated() event: