Skip to main content

xhrSender

Package​

Installation​

npm install @rpldy/sender

Details​

type send = SendMethod

This is the default send method used by Uploady/Uploader.

Normally, it is used internally and there is no reason to interact with this method directly.

However, Enhancers may want to wrap the send functionality with some custom logic.

Example​

import { Uploady } from "@rpldy/uploady";
import { send } from "@rpldly/sender";

const mySend = (items, url, sendOptions, onProgress) => {

//implement some custom logic here

return send(items, url, sendOptions, onProgress);
};

const MyApp = () => {
return <Uploady send={mySend}>
<RestOfMyApp/>
</Uploady>;
};

Alternatively, you can also create a reusable enhancer that will set your custom send method:

const myEnhancer = (uploader) => {
//make uploader use the custom send method
uploader.update({ send: mySend });

return uploader;
};

const MyApp = () => {
return <Uploady enhancer={myEnhancer}>
<RestOfMyApp/>
</Uploady>;
};