https://github.com/jeetiss/callbag-xhr
https://github.com/jeetiss/callbag-xhr
callbag callbags xhr
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jeetiss/callbag-xhr
- Owner: jeetiss
- Created: 2018-10-13T10:02:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-15T15:22:02.000Z (almost 7 years ago)
- Last Synced: 2025-02-13T09:37:24.705Z (8 months ago)
- Topics: callbag, callbags, xhr
- Language: JavaScript
- Size: 52.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# callbag-xhr
Callbag source which wrap xhr request with first class cancel and progress support.
## install
```
npm i @jeetiss/callbag-xhr
```
## example
```js
import pipe from "callbag-pipe";
import subscribe from "callbag-subscribe";
import request from "@jeetiss/callbag-xhr";
const data = new FormData();
data.append("UPLOADCARE_PUB_KEY", "demopublickey");
data.append("UPLOADCARE_STORE", "auto");
data.append("file", file);
pipe(
request({
method: "POST",
url: "https://upload.uploadcare.com/base/",
data,
upload: true
}),
subscribe({
next: val => console.log("next:", val),
complete: () => console.log("done!"),
error: err => console.log("error:", err)
})
)
```