Skip to main content

useItemStartListener

Package​

@rpldy/uploady

Installation​

npm install @rpldy/uploady

Details​

type useItemStartListener = ItemCancellableEventHook;
note

Event Hook - ITEM-START

Called when item starts uploading (just before) For grouped uploads (multiple files in same xhr request) ITEM_START is triggered for each item separately

info

This event is cancellable

info

This event can be scoped to a specific item by passing the item id as a second parameter

Example​

    import { useItemStartListener } from "@rpldy/uploady";

const MyComponent = () => {
useItemStartListener((item) => {
console.log(`item ${item.id} started uploading`);
});

//or scoped:
useItemStartListener((item) => {
console.log(`item ${item.id} started uploading`);
}, "i-123");

//...
};