-
Notifications
You must be signed in to change notification settings - Fork 131
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
Clarify: What should happen on repeated listener addition for the same contextType/intent #1390
Comments
The answer to this is not explicitly stated in the standard to my knowledge (it should be!). However, it consistently says that Hence, I would go ahead and assume that you can add multiple listeners of the same or overlapping types (i.e. I think the answer is different for intent handling, where it only makes sense for a single handler to be present per intent name (context type is not an argument to Given these two very similar API calls are (and IMHO need to be) handled differently it would make sense for us to clarify this in the documentation of I'd suggest that this is a clarification worth adding to the 2.3 scope. If you agree with the above and are happy to convert this question into an issue (replace 'Question' in the title with 'Clarify') I think we could agree a PR to resolve quite quickly. |
I think that it is quite likely that for a given app there might be multiple differnet parts in the app that might want to listen to a single intent being raised. One component might want to actually handle the intent and do something useful but another component might just want to display the context that is currently being handled. I would say that this should probably be allowed - until @kriswest point about the Because of this throwing an error when a second intent handler is registered for the given intent and app seems sensible to me. |
Thanks for the reply, @kriswest and @Roaders! Originally I thought it would make sense to handle both of then with an error, especially since it seems so unintuitive to handle them differently (and, as you, @kriswest, pointed out, for the intent handler, that seems to be the only solution). However, through your examples it makes sense to me to have these behaviors be different and follow your approach. Definitely agreed on a need for a very specific and clear documentation on this and a separate error. I will edit the title and, whenever I have bandwidth, will work on adding this change (unless someone does it before me) |
Question Area
Question
What should happen in the situation where for example app does:
await fdc3.addContextListener('fdc3.contact', (contact, metadata) => {... });
await fdc3.addContextListener('fdc3.contact', contact => { ... });
Or some different handler?
I see 3 possible options (in no particular order):
Does the standard have any ruling on this, I was not able to find on the docs (please, let me know if I missed it)?
The text was updated successfully, but these errors were encountered: