如何将 Google 的范围绑定到 fetch_page 函数?我需要能够在 promise-then 链中将函数链接在一起。
Google.prototype.search = function(keyword){
this.keyword = keyword || this.keyword;
fetch_page().then(parse_page).then(function(){
console.log('done');
});
});
function fetch_page(){
// I wants to access google's this.keyword
}
function parse_page(){
// I also wants to access google's this.keyword
}
有任何想法吗?