Package Exports
- superagent-as-promised
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (superagent-as-promised) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SuperAgent as Promise(d)
Installation
npm install superagent-as-promised
Usage
var request = require('superagent');
require('superagent-as-promised')(request);
Then
request
.get('/location')
.then( function(response) {
console.log("Got "+response.text);
})
.catch( function(error) {
console.dir(error);
})
is syntactic sugar for:
var promise = request
.get('/location')
.endAsync();
promise
.then( function(response) {
console.log("Got "+response.text);
})
.catch( function(error) {
console.dir(error);
})