【文件属性】:
文件名称:superagent-es6-promise:叉superagent-bluebird-promise并删除bluebird以使用本机Promise
文件大小:5KB
文件格式:ZIP
更新时间:2021-04-27 14:28:05
CoffeeScript
superagent-es6-promise
向添加支持。
它最初是从分叉的。
安装
npm install superagent-es6-promise
用法
只需使用此软件包而不是superagent 。 然后,您可以调用.then()而不是.end()来获得对您的请求的承诺。
var request = require ( 'superagent-es6-promise' ) ;
request . get ( '/an-endpoint' )
. then ( function ( res ) {
console . log ( res ) ;
} , function ( error ) {
console . log ( error ) ;
} ) ;
要生成承诺而不注册任何回调(例如,从库中返回承诺时),请调用.promise() 。
【文件预览】:
superagent-es6-promise-master
----.travis.yml(57B)
----LICENSE(1KB)
----test()
--------test.coffee(2KB)
----README.md(1KB)
----.gitignore(535B)
----index.js(2KB)
----package.json(1KB)