useItemStartListener
Packageβ
Installationβ
- npm
- Yarn
- pnpm
npm install @rpldy/uploady
yarn add @rpldy/uploady
pnpm add @rpldy/uploady
Detailsβ
type useItemStartListener = ItemCancellableEventHook;
- See: ItemCancellableEventHook
- See: BatchItem Entity
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");
//...
};