Open matamune94 opened 3 years ago
@matamune94 try it:
(async()=>{
const obj = {};
obj.code = async()=>{
await new Promise((r)=>setTimeout(r, 250)); // not important line
return ['one', 'two'];
};
const w = await chrome.windows.create({url: 'https://google.com'});
console.log(w);
await new Promise((r)=>setTimeout(r, 1000)); // sometimes - important line
try{
const r = await chrome.tabs.executeAsyncFunction(w.tabs[0].id, obj);
console.log(r);
}catch(e){
console.log(e);
}
})();
also, make sure about permissions and the order of scripts:
"permissions": ["storage", "*://www.google.com/*", "tabs"],
"background": {"scripts": ["libs/cea.js", "libs/cea-eaf.js", "js/background.js"]},
I make error :
my code:
Any have idea ?