So after the CORB issue of chrome extension i migrated the api calls to background script and used callback from the background script to send response of a JSON.
So I have a doubt regarding the response i receive from callback i want it to return it.
async function request (path, apiToken, options) {
chrome.runtime.sendMessage({type: "request", path:path, apiToken:apiToken, options:options}, (all) => {
return Promise.resolve(all.json )
})
}
I call request => it goes to background => background return the response => then the request function should return a promise. I'm stuck on the last step as im unable to return it from inside the callback,