I need to send information asynchronous from content script to popup page sendResponse works fine with synchronous but I don't know how to send asynchronous.
I'm working with Jsforce library works fine
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if(request.action == "rest") {
if(data.sid==undefined) {
return null;
}
console.log(request);
conn.apex.get(request.url, function(err, res) {
if (err) {
return console.error(err);
}
console.log(res); //**works fine but I need return to popup script**
sendResponse({r: res}); //asynchronous does not work
});
return true;
}
});