everyone.now.getGuess = function(val) {
db.view('lists', 'project_names', {
startkey: val,
endkey: val + "\u9999"
}, function(_, data) {
return data.rows.map(function(obj) {
return obj['key'];
});
});
return this.now.receiveGuess(guesses[0]);
};
db 是nano的对象。db.view 不返回任何内容,只提供回调,因此guesses = db.view() 不起作用。在 db.view() 的回调中,我暂时无法访问now.js。
我该如何解决这个问题?