Search...
onGalleryCreated( )
An event that triggers when a gallery is created.
Description
The onGalleryCreated()
event handler runs when a gallery has been created. The received GalleryCreated
object contains information about the gallery that was created.
Notes:
- Backend events don't work when previewing your site.
- The event data doesn't include gallery items or their IDs. To get information about the items in your newly created gallery, listen for the
onGalleryItemCreated()
event.
Syntax
function onGalleryCreated(event: GalleryCreated): void
onGalleryCreated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
GalleryCreated
Information about a newly created gallery.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event triggered when a gallery is created
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixProGallery_onGalleryCreated(event) {6 const galleryId = event.entity._id;7 const galleryName = event.entity.name;8 const eventId = event.metadata.id;9 const eventTime = event.metadata.eventTime;10}1112/* Full event object:13 * {14 * "entity": {15 * "_createdDate": "2022-08-04T10:00:09.000Z",16 * "_id": "b082d5aa-1e7b-44d9-91f3-ab0387825de5",17 * "items": [],18 * "name": "My New Gallery",19 * "totalItems": 220 * },21 * "metadata": {22 * "entityId": "b082d5aa-1e7b-44d9-91f3-ab0387825de5",23 * "eventTime": "2022-08-04T10:00:09.559484Z",24 * "id": "1586937f-a154-4ad1-8ccf-488a63852e63",25 * "triggeredByAnonymizeRequest": false26 * }27 * }28 */