JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13901
  • Score
    100M100P100Q142547F
  • License MIT

SuperAgent with a Promise twist

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)

SuperAgent as Promise

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);
  })