How can we implement this in dart 2?
content_script.js:
chrome.runtime.sendMessage("hello", function(response) {
console.log(response);
});
backgroud.js:
chrome.runtime.onMessage.addListener(function(a,b, responseCallback){
responseCallback("world");
});
When responseCallback("world");
is called from dart it doesn't send the response back to sender.
I already have implemented an example that is able to read parameters from events when they are fired but it is not able to send a response because responseCallback
is passed as a parameter :
https://gitlab.com/drbcode/chrome.dart/blob/master/examples/runtime_test/lib/runtime.dart#L46
API docs:
https://developer.chrome.com/apps/runtime#method-sendMessage https://developer.chrome.com/apps/runtime#event-onMessage