-
Notifications
You must be signed in to change notification settings - Fork 56
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
Proposal: Event.addListener should accept an interface. #519
Comments
Maybe use |
I learned something new today, didn't know that was a thing. |
I don't see why this specific solution would be the best way to address common parameters given the current design of WebExtensions APIs. It seems like we could accomplish something similar by having common parameters in an optional property bag. As you mentioned, a number of existing event listener already have the equivalent of an It's also worth noting that the web uses a different approach to what this issue proposes for common properties associated with all events; the web uses an Beyond that, I'm also very hesitant about changing how All that said, I'm very interested in cleaning up how extension event listeners are registered and managed. I would like to explore what the platform would look and feel like if we used an event model that's more in line with the web platform. Specifically, things like using potentially using the |
I'm interesting in having a designated area where you can supply parameters that might be relevant to all events. If the 2nd parameter makes more sense, that's also fine.
My intent is to make it easier to change how the addListener behaves. If there's no appetite for that, I think this is a dead end proposal. I'll close it for now and mull it over. Thank you for the detailed reply. |
At this point I don't think we know how much appetite there is. I have concerns, but I don't speak for any browsers. It might be worth discussing this idea in a meeting to get a sense of how this approach strikes the browser reps. Even if they raise concerns, that conversation may help inform what we explore next. |
Would this create a situation where documentation would constantly be saying this such as: like an interface except or like a namespace except. I'm being impressionistic because I'm not sure those exact words would be used. I'm trying to make the point that exceptions to existing patterns can be stumbling blocks to users even when they're adequately documented. |
addEventListener accepts an interface for decades(?) and how many developers are confused by its documentation or implementation? I think it's probably 0 because this edge case is ignored by anyone who is not looking for it specifically. So it's possible to document/implement this functionality without creating unnecessary confusion. |
I was about to elaborate, but realized I overlooked part of Simeon's statement. "But that's all a bit tangential to this specific proposal." I'll comment again if a specific proposal is made. |
addListener accepts a callback function as the first argument. The subsequent arguments are used for event-specific types. For example,
webRequest.onAuthRequired.addListener
takes aRequestFilter
for the second argument, andextraInfoSpec
for the third.There's no place to provide parameters that are relevant to all events. Allowing an interface for the first argument would provide the flexibility for future use cases and proposals. For example, I make use of this hypothetical interface in my #501 proposal.
The text was updated successfully, but these errors were encountered: