dimanche 1 mars 2015

How to pass parameters to Node's Q library's (denodeify) promise handler


In the below code I would like to have variables a, b, c to be passed as parameter when processhttprequest() gets called.



var q = require("q");
var request = require('request');

function myfun()
{
var a, b, c;
//do some work here
var httprequest = q.denodeify(request);
var httprequestpromise = httprequest(httpoptions);
httprequestpromise.then(processhttprequest);
}


I tried httprequestpromise.then(processhttprequest.bind([a, b, c])); but no luck. Is this supported by Q, or any other promise library.





Aucun commentaire:

Enregistrer un commentaire