I am trying to understand getEventBus()
. Can somebody provide a tutorial or best example where and how we can implement getEventBus()
.
相关问题
- Stop child process when parent process stops
- Fire resize event once not based on timing
- C# CS0079 Event Handling Compile Errors
- Google Maps event listeners not working properly i
- execute method when iPhone enters landscape mode
相关文章
- What does it means in C# : using -= operator by ev
- How are custom broadcast events implemented in Jav
- Programming a touch screen application with SWING
- How many pixels are scrolled on a website with a m
- Difference Between RoutedEventHandler and EventHan
- Wait for function till user stops typing
- WPF- validation error event doesn't fire
- Button onclick doesn't fire after onchange inp
I´ve provided an example to answer another question here.
To put it in a nutshell, you can call
sap.ui.getCore().getEventBus()
to get access to the EventBus instance. As it comes from the core it´s the same across all of your views/controllers. The EventBus provides you with the publish/subscribe functionality. This for example enables you to publish an event in Controller A and notify the subscribed Controller B. A simple example largely from my other answer:Subscribing to the EventBus:
Of course you can name your channel and events as you wish. The third parameter indicates the function, that will be called in case of published events. The last paramter is the scope, 'this' will point to in the given function.
Your
handleEvent1
function could look like this:Publishing events to the EventBus:
If you have more questions about it let me know so I´ll extend it.