chrome extension - sendResponse not waiting for async function
问题 I am having an issue of asynchronicity (I believe). sendResponse() in contentscript.js does not wait for getThumbnails() to return. I am sending a message in popup.js : chrome.tabs.sendMessage(tabs[0].id, {message: "get_thumbnails", tabUrl: tabs[0].url}, function (respThumbnails) { const thumbUrl = respThumbnails.payload; console.log("payload", thumbUrl) } ); Then, in contentscript.js I listen for this message: chrome.runtime.onMessage.addListener(async function(request,sender,sendResponse) {