Skip to content
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

added sendResponse argument to browser.runtime.onMessage.addEventListener() #55

Closed
wants to merge 3 commits into from

Conversation

eugbyte
Copy link

@eugbyte eugbyte commented Apr 25, 2021

In the library, browser.runtime.onMessage.addEventListener(message, sender) only accepts 2 arguments. However, in the official Javascript API, this method receives an additional 3rd argument, sendResponse(), a callback function.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage

@Lusito
Copy link
Owner

Lusito commented Apr 26, 2021

Sorry about the work you've put into this, but I won't merge this.
As you can see in the page you linked: "Returning a Promise is now preferred, as sendResponse() will be removed from the W3C spec."

Please use a promise as return value instead of using sendResponse.

@Lusito Lusito closed this Apr 26, 2021
@montogeek
Copy link

Does this polyfill cover returning a Promise?
It is currently not supported https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage

@eugbyte
Copy link
Author

eugbyte commented May 12, 2021

@montogeek
#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants