I would like to proxy the callback function for chrome.history.search
to get the history items.
Here is an example:
chrome.history.search({text: '', maxResults: 10}, function(data) {
// ...
});
For this example I want to capture the 10 most recently visited URLs.
Here is what I tried:
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)
}
})
How do I improve this to proxy the callback function of chrome.history.API and log the 10 most recently visited URLs that are passed to the callback function?
Do it inside your own custom callback, then call the original callback if it was present: