Attribute Macro junobuild_macros::on_delete_asset

source ·
#[on_delete_asset]
Expand description

The on_delete_asset function is a procedural macro attribute for hooking into the OnDeleteAsset event. It allows you to define custom logic to be executed when an asset is deleted.

Example:

#[on_delete_asset]
async fn on_delete_asset(context: OnDeleteAssetContext) -> Result<(), String> {
    // Your hook logic here
}

When no attributes are provided, the hook is triggered for any asset deletion within any collection. You can scope the events to a particular list of collections.

Example:

#[on_delete_asset(collections = ["demo"])]
async fn on_delete_asset(context: OnDeleteAssetContext) -> Result<(), String> {
    // Your hook logic here
}

The attributes accept a list of comma-separated collections. If the attribute array is left empty, the hook will never be called.