Search...
onGalleryItemUpdated( )
An event that triggers when a media item in a specified gallery is updated.
Description
The onGalleryItemUpdated()
event handler runs when a gallery item has been updated. The received GalleryItemUpdatedEvent
object contains information about the gallery item that was updated.
Note: Backend events don't work when previewing your site.
Syntax
function onGalleryItemUpdated(event: GalleryItemUpdatedEvent): void
onGalleryItemUpdated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
GalleryItemUpdatedEvent
Information about an updated gallery item.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event triggered when a gallery item is updated
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_onGalleryItemUpdated(event) {6 const galleryItemId = event.data.updatedItem._id;7 const galleryItemDescription = event.data.updatedItem.description;8 const eventId = event.metadata.id;9 const eventTime = event.metadata.eventTime;10}1112/* Full event object:13 * {14 * "data": {15 * "updatedItem": {16 * "_createdDate": "2022-08-04T10:00:09.000Z",17 * "_id": "b082d5aa-1e7b-44d9-91f3-ab0387825de5",18 * "description": "The best addition to my gallery",19 * "tags": {20 * "values": ["voice","bees","wind"]21 * },22 * "title": "My Updated Item"23 * "type":"IMAGE",24 * "image": {25 * "type":"WIX_MEDIA",26 * "imageInfo": "wix:image://v1/9e6ea4_650d8cd45f7545c4b39178feb0ee8c70~mv2.jpg/300.jpg#originWidth=200&originHeight=300"27 * },28 * },29 * "metadata": {30 * "entityId": "b082d5aa-1e7b-44d9-91f3-ab0387825de5",31 * "eventTime": "2022-08-04T10:00:09.559484Z",32 * "id": "1586937f-a154-4ad1-8ccf-488a63852e63",33 * "triggeredByAnonymizeRequest": false34 * }35 * }36 */