Search.../

onGalleryItemDeleted( )

An event that triggers when a media item in a specified gallery is deleted.

Description

The onGalleryItemCreated() event handler runs when a gallery item has been deleted. The received GalleryItemDeletedEvent object contains information about the gallery item that was deleted.

Note: Backend events don't work when previewing your site.

Syntax

function onGalleryItemDeleted(event: GalleryItemDeletedEvent): void

onGalleryItemDeleted Parameters

NAME
TYPE
DESCRIPTION
event
Optional
GalleryItemDeletedEvent

Information about a deleted gallery item.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event triggered when a gallery item is deleted

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixProGallery_onGalleryItemDeleted(event) {
6 const deletedGalleryItemId = event.data.itemId;
7 const eventId = event.metadata.id;
8 const eventTime = event.metadata.eventTime;
9}
10
11/* Full event object:
12 * {
13 * "data": {
14 * "itemId":"2e2566e6-f242-4d4b-89bc-c5ad826e6241"
15 * },
16 * "metadata": {
17 * "entityId": "b082d5aa-1e7b-44d9-91f3-ab0387825de5",
18 * "eventTime": "2022-08-04T10:00:09.559484Z",
19 * "id": "1586937f-a154-4ad1-8ccf-488a63852e63",
20 * "triggeredByAnonymizeRequest": false
21 * }
22 * }
23 */