Is there any way to make a synchronous communication between the content script and the main addon script?
If i make a method like this for then the method returns immediately. So is there any way to wait for the main script to respond and then process the result?
main.js
worker.port.on("GetValue"),function(key)
{
worker.port.emit('GetValue',ss.storage[key]);
}
content script
//get value from local storage
function GetValueFromLocalStorage(key)
{
self.port.emit("GetValue", key);
self.port.on("GetValue", function (value)
{
return value;
});
}
It would be beneficial if this was possible because async code is not clean and organized and a nightmare to write especially if i have to access this method more than once.