-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Responding in onMessage does not work #150
Comments
does calling |
the question on SO http://stackoverflow.com/questions/22114022/ |
@financecoding With |
I tried |
Using @draškoKokić s solution I was able to send messages in both directions (he uses dart:js instead of chrome.dart) |
Yep. I can work with his solution to use the js-version of the chrome-api. Thanks for the help. So this is a bug in chrome.dart? |
I see it as temporary workaround. I would also prefer using chrome.dart. |
Played a bit around what exactly is not working in chrome.dart - Seems that the bug should be in the eventlistener-part. Using //...
chrome.runtime.sendMessage({
'action': "refresh"
}).then((_){
print('receiving response!');
});
//... also works. |
I came to the same conclusion.
|
any suggestions on what type of code we need to generate so this can be done purely with chrome.dart? Does the SO answer actually full fill the the solution? |
I think some code like this is missing https://github.com/dart-gde/chrome.dart/pull/52/files#diff-eec526293951e120cef02fa5674414aaR336 #135 is probably a similar problem ( |
Does anyone have any update on the native chrome.dart progress? |
Just ran into this issue myself. I have some native JS code in an extension pop up that sends a message to the background script that's written in Dart.
I found that the sendResponse function was being called but sessionId is undefined. Tried with JS objects (via JsObject.jsify(...)) as well with the same result; the data in the callback attached to sendMessage doesn't appear to be populating properly. |
If I change
then the messages appear to send properly. Not sure that should be the default behavior though since that will always leave the message channel open until sendResponse is called. The issue seems very similar to #252 |
I'am trying to develop a chrome extension with dart.
To explain my problem let's take a look at this simple extention:
In the background-script i'm calling:
My popup-scripts looks like this:
What is working: The message 'refresh' send from popup-script to background-script works! The background-script prints Refresh called!.
What is not working: The popup-script never receives the response called from the background-script: new JsObject(response, [new JsObject.jsify({'done': true})]);.
I don't know how to handel sendResponse to really send an response. Maybe my call with JsObject is wrong? Hope someone else can help. (Btw. also a non async-response doesn't work here.)
The text was updated successfully, but these errors were encountered: