Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

superagent-rxjs

2.2.3 • Public • Published

superagent-rxjs

npm Build Status Coveralls Dependency Status Standard Version npm

Return an RxJS v5 Observable from your superagent request

Installation

Add it to your project via npm or yarn (recommended):

npm install --save superagent-rxjs

If you haven't already, also add superagent and rxjs as a dependency to your project:

npm install --save superagent rxjs

Usage

import request from 'superagent'
import observify from 'superagent-rxjs'
 
// mutates superagent's Request.prototype and adds the .observify() method to it
observify(request)
 
// use it!
const observable = request.get('http://example.com').observify()
const subscription = observable.subscribe()
 
// calling unsubscribe before the request has finished will abort the request
subscription.unsubscribe()

API

observify :: Request -> void

Adds the observify method to superagent's Request.prototype and returns nothing

Credits

Thanks Kriegslustig for helping out on the tests 😄

install

npm i superagent-rxjs

Downloadsweekly downloads

352

version

2.2.3

license

ISC

repository

githubgithub

last publish

collaborators

  • avatar