Is there a way to make synchronous communication between the contents of the script and the main script addon?
If I create such a method, the method returns immediately. So, is there a 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 useful if it were possible because the asynchronous code was not clean and organized, and writing a nightmare especially if I need to access this method more than once.
source share