所以我正在尝试使用Facebook集成构建我的第一个webapp(使用facebook-node-sdk).我让它对api进行简单的调用,但是现在是时候将它们放在一个简单的服务器中并根据请求进行调用(这不是webapp本身,而是更多的API服务器).
我遇到的问题是,即使我(大概)使用蓝鸟来宣传Facebook sdk和我的makeCall方法,我仍然得到"hi"打印然后"未定义" - console.log在makeCall之前被调用什么都归还
这是我的app.js:
var Promise = require('bluebird')
, http = require('http')
, Facebook = Promise.promisifyAll(require('facebook-node-sdk'))
, config = require('./config')
, fb = new Facebook({ appId: config.fb.api, secret: config.fb.secret });
var makeCall = new Promise.method(function (username) {
return fb.api(username, function(err, data) {
console.log('hi')
if (err) return err;
return data;
});
});
http.createServer( function (req, res) {
makeCall('/me').then(console.log)
}).listen(8001);
Run Code Online (Sandbox Code Playgroud) jQuery('.parent:visible').each(function () {
if (jQuery(this).find('.child-1').is(':hidden')) {
jQuery(this).find('.child-2').css('color', '#000')
}
});
Run Code Online (Sandbox Code Playgroud)
选择孩子很容易,分开,但由于ifCSS 中没有语句,我希望有一些我缺少的神奇CSS.
编辑:根据建议修复js