Javascript “是否存在”的回调;chrome.storage.local.set“;
只有在设置了Chrome.storage.local之后,我才需要发回Chrome消息,但是我找不到一种方法来“导入”其中的Javascript “是否存在”的回调;chrome.storage.local.set“;,javascript,google-chrome-extension,Javascript,Google Chrome Extension,只有在设置了Chrome.storage.local之后,我才需要发回Chrome消息,但是我找不到一种方法来“导入”其中的sendResponse函数 请考虑所有这些代码都被执行到背景脚本 >和>强> >从Cordon脚本和/或从浏览器动作弹出窗口发送的消息< /强>触发。所以这就是为什么我需要回复 你知道吗 的回调签名为: 但你却通过了: function (sendResponse) { console.log(`documents_cache ha
sendResponse
函数
请考虑所有这些代码都被执行到<强>背景脚本<强> >和>强> >从Cordon脚本和/或从浏览器动作弹出窗口发送的消息< /强>触发。所以这就是为什么我需要回复
你知道吗 的回调签名为: 但你却通过了:
function (sendResponse) {
console.log(`documents_cache has been saved`);
documents = new Array(); // Empty the array
sendResponse("documents have been loaded and saved!"); // <-- this does not work
}
综上所述,只需将回调更改为。将设置为不接受任何参数:
function () {
console.log(`documents_cache has been saved`);
documents = new Array(); // Empty the array
sendResponse("documents have been loaded and saved!"); // <-- this does not work
}
函数(){
log(`documents\u cache已保存`);
documents=new Array();//清空数组
sendResponse(“文档已加载并保存!”)//
// Recursive ajax call
function get_and_merge_data(cursor = null, token, sendResponse) {
function () {
console.log(`documents_cache has been saved`);
documents = new Array(); // Empty the array
sendResponse("documents have been loaded and saved!"); // <-- this does not work
}