я получаю эту ошибку:объект метод применяется при вызове wrapAsync
Object <object> has no method apply
при вызове этой функции
var fb = new Facebook(Meteor.user().services.facebook.accessToken);
data =Meteor.wrapAsync(fb.query("https://stackoverflow.com/search?q=" + keywords + "&type=page&fields=name,category,can_post,likes,link,location,emails,phone"));
on server side.
Update: после попытки этого:
var fb = new Facebook(Meteor.user().services.facebook.accessToken);
var fbQuerySync = Meteor.wrapAsync(fb.query, fb);
var data = fbQuerySync("https://stackoverflow.com/search?q=" + keywords + "&type=page&fields=name,category,can_post,likes,link,location,emails,phone");
я получаю эту ошибку
Error inside the Async.runSync: Property 'function (/* arguments */) { // 99
W20150402-21:30:07.620(0)? (STDERR) var args = _.toArray(arguments); // 100
W20150402-21:30:07.620(0)? (STDERR) // 101
W20150402-21:30:07.620(0)? (STDERR) var runWithEnvironment = function() { // 102
W20150402-21:30:07.620(0)? (STDERR) var savedValues = Fiber.current._meteor_dynamics; // 103
W20150402-21:30:07.620(0)? (STDERR) try { // 104
W20150402-21:30:07.620(0)? (STDERR) // Need to clone boundValues in case two fibers invoke this // 105
W20150402-21:30:07.620(0)? (STDERR) // function at the same time // 106
W20150402-21:30:07.621(0)? (STDERR) Fiber.current._meteor_dynamics = _.clone(boundValues); // 107
W20150402-21:30:07.621(0)? (STDERR) var ret = func.apply(_this, args); // 108
W20150402-21:30:07.621(0)? (STDERR) } catch (e) { // 109
W20150402-21:30:07.621(0)? (STDERR) // note: callback-hook currently relies on the fact that if onException // 110
W20150402-21:30:07.621(0)? (STDERR) // throws and you were originally calling the wrapped callback from // 111
W20150402-21:30:07.621(0)? (STDERR) // within a Fiber, the wrapped call throws. // 112
W20150402-21:30:07.622(0)? (STDERR) onException(e); // 113
W20150402-21:30:07.622(0)? (STDERR) } finally { // 114
W20150402-21:30:07.622(0)? (STDERR) Fiber.current._meteor_dynamics = savedValues; // 115
W20150402-21:30:07.622(0)? (STDERR) } // 116
W20150402-21:30:07.622(0)? (STDERR) return ret; // 117
W20150402-21:30:07.622(0)? (STDERR) }; // 118
W20150402-21:30:07.623(0)? (STDERR) // 119
W20150402-21:30:07.623(0)? (STDERR) if (Fiber.current) // 120
W20150402-21:30:07.623(0)? (STDERR) return runWithEnvironment(); // 121
W20150402-21:30:07.623(0)? (STDERR) Fiber(runWithEnvironment).run(); // 122
НУ-НС: метод уже синхронизироваться, кажется, вот еще один кусок кода:
Facebook.prototype.query = function(query, method) {
var self = this;
var method = (typeof method === 'undefined') ? 'get' : method;
var data = Meteor.sync(function(done) {
self.fb[method](query, function(err, res) {
done(null, res);
});
});
return data.result;
}
взгляните на мое обновление – Genjuro