【发布时间】:2021-03-07 04:48:13
【问题描述】:
我想代理chrome.history.search的回调函数来获取历史记录。
这是一个例子:
chrome.history.search({text: '', maxResults: 10}, function(data) {
// ...
});
对于本例,我想捕获最近访问的 10 个 URL。
这是我尝试过的:
chrome.history.search = new Proxy(chrome.history.search, {
apply: (target, thisArg, argumentsList) => {
console.log(argumentsList[1]) // this gives me the callback function not the data items
return target.apply(thisArg, argumentsList)
}
})
如何改进它以代理 chrome.history.API 的回调函数并记录传递给回调函数的 10 个最近访问的 URL?
【问题讨论】:
标签: javascript google-chrome-extension proxy browser-history es6-proxy