From b86d03020d9e2e0ba69d14b876c2deed4c9607db Mon Sep 17 00:00:00 2001 From: henrique matias Date: Thu, 13 Nov 2014 02:55:01 +0000 Subject: [PATCH] returning request object when calling api method Adding this return calls, this way you can keep the returned object from the "request" method and then have chance to call .abort() or any other method available. --- fb.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fb.js b/fb.js index 8e90931..65d15ee 100644 --- a/fb.js +++ b/fb.js @@ -132,9 +132,9 @@ // // if(typeof arguments[0] === 'string') { - graph.apply(this, arguments); + return graph.apply(this, arguments); } else { - rest.apply(this, arguments); + return rest.apply(this, arguments); } }; @@ -194,7 +194,7 @@ return; } - oauthRequest('graph', path, method, params, cb); + return oauthRequest('graph', path, method, params, cb); }; /** @@ -209,7 +209,7 @@ params.format = 'json-strings'; var domain = readOnlyCalls[method] ? 'api_read' : 'api'; - oauthRequest(domain, 'restserver.php', 'get', params, cb); + return oauthRequest(domain, 'restserver.php', 'get', params, cb); }; /** @@ -317,7 +317,7 @@ if(options('timeout')) { requestOptions['timeout'] = options('timeout'); } - request(requestOptions + return request(requestOptions , function(error, response, body) { if(error !== null) { if(error === Object(error) && has(error, 'error')) { @@ -651,7 +651,7 @@ if(options('proxy')) { requestOptions['proxy'] = options('proxy'); } - + request( requestOptions , function(error, response, body) {