Javascript Coffeescript-跳过完整的静态方法
好吧,我对咖啡脚本很陌生,很难弄清楚这里发生了什么。我正在使用instagram节点库构建hubot脚本。InstagramOAuth.prototype.ask_for_access_令牌类complete方法刚刚被完全跳过Javascript Coffeescript-跳过完整的静态方法,javascript,node.js,oauth,coffeescript,Javascript,Node.js,Oauth,Coffeescript,好吧,我对咖啡脚本很陌生,很难弄清楚这里发生了什么。我正在使用instagram节点库构建hubot脚本。InstagramOAuth.prototype.ask_for_access_令牌类complete方法刚刚被完全跳过 robot.router.get '/hubot/feedbomb', (req, res) -> Instagram.oauth.ask_for_access_token( grant_type: 'authorization_code' co
robot.router.get '/hubot/feedbomb', (req, res) ->
Instagram.oauth.ask_for_access_token(
grant_type: 'authorization_code'
code: accounts[account].details.theCode
request: req
response: res
complete: (params, response) ->
user_acces_token = params['access_token']
response.writeHead(200, {'Content-Type': 'text/plain'})
res.end "Yup!"
error: (errorMessage, errorObject, caller, response) ->
console.log("Error on #{errorObject}: #{errorMessage}")
res.end "McNope"
)
我很确定这是我不太理解的事情
编辑
我在instagram节点库中添加了ask_for_access_token方法,以防有什么东西对某人来说显而易见。我想可能是点符号还是文字符号
InstagramOAuth.prototype.ask_for_access_token = function(params) {
var parsed_query, token_params, url;
url = require('url');
parsed_query = url.parse(params['request'].url, true).query;
if (parsed_query.error != null) {
return this.parent._error("" + parsed_query.error + ": " + parsed_query.error_reason + ": " + parsed_query.error_description, parsed_query, 'handshake');
} else if (parsed_query.code != null) {
token_params = {
complete: params['complete'],
response: params['response'],
method: "POST",
path: "/oauth/access_token",
post_data: {
client_id: this.parent._config.client_id,
client_secret: this.parent._config.client_secret,
grant_type: 'authorization_code',
redirect_uri: params['redirect_uri'] === void 0 || params['redirect_uri'] === null ? this.parent._config.redirect_uri : params['redirect_uri'],
code: parsed_query.code
}
};
this.parent._request(token_params);
if (params['redirect'] != null) {
params['response'].redirect(params['redirect']);
return params['response'].end();
}
}
};
你说跳过是什么意思?它从不执行,或者在调用请求\u访问\u令牌之后的代码之前不执行?@AaronDufour:它根本不执行代码。但是如果你用一行代码替换这个方法,它会很好地执行。因此,我尝试创建一个名为completion的方法来调用complete,但我也无法传递参数或响应。此外,我尝试使用js2coffee,它告诉我这是我想要的正确方法。我被难住了!