使用代理对象覆盖Chrome Storage API

问题描述

使用JavaScript代理调用Chrome Storage API时,如何覆盖chrome.storage.local.get以便记录存储密钥的值

这是我尝试过的:

const api = chrome.storage.local;
const { set } = api; 
api.set = new Proxy(api.set,{
    apply: (target,thisArg,argumentsList) => {
        console.log(argumentsList[0]);
        return target(argumentsList[0]);
    }
});

调用Illegal invocation: Function must be called on an object of type StorageArea时出现target(argumentsList[0])错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)