1.1.4 • Published 3 years ago
@transclusion/request v1.1.4
@transclusion/request
For making observable requests in the browser and in Node.js.
# Install with npm
npm install @transclusion/request
# Install with yarn
yarn add @transclusion/request
Usage
import {get} from '@transclusion/request'
// Make a request observable
const req = get('https://www.google.com')
// The request will be sent whenever it is subscribed to
const subscription = req.subscribe({
next(res) {
if (res.readyState === 3) {
console.log(`Loaded: ${res.bytesLoaded / res.bytesTotal * 100}%`)
}
if (res.readyState === 4) {
console.log(`Text: ${res.text}`)
}
},
error(err) {
console.error(err.stack)
},
complete() {
console.log('DONE')
}
})
// To abort the request at any time, simply unsubscribe:
subscription.unsubscribe()
License
MIT © Marius Lundgård
1.1.4
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
1.0.0-beta.2
6 years ago
1.0.0-beta.1
6 years ago
1.0.0-beta.0
6 years ago
1.0.0-alpha.7
6 years ago
1.0.0-alpha.6
6 years ago
1.0.0-alpha.5
6 years ago
1.0.0-alpha.4
7 years ago
1.0.0-alpha.3
7 years ago
1.0.0-alpha.2
7 years ago
1.0.0-alpha.1
8 years ago