Listen on event from not related component

I would like to fire an event from one component and react to this event on a different component.
These components don’t know about each other.

it this approach valid, please?

I could not find it in the official documentation.
Thank you here it’s official.

Here is another example in the tutorial. Create a form in Vaadin with data binding and validation.

I like this better as it actually declares an API for other components to register. If I’d do something similar to the cookbook example, I’d expose the API in the view class, instead of hacking the listeners with ComponentUtil to the UI class.

Hi, thank you for the suggestions. I need way for the case, where components don’t know about each other. With example from cookbook I can do that. But with second example I think it is not really possible.

You’re asking “Listen on event from not related component”, if one component is reacting to a change of another component, then they are definitely related. The Event bus will “hide” the relation.
In my opinion, it’s safer to make the component to listen directly to the other one. (It’s not always easy to do this, it depends on the complexity of the application)

thank you, I will try then re-arrange app that components can “see” each others.