Introducing: The Client Side Event Bus in Oracle JET for decoupled interactions across templates, view models and modules with Knockout Postbox by Lucas Jellema
By Juergenkress-Oracle on Jul 07, 2016
Well organized exchange of client side events has been something of a holy grail for client side web development to me. I do not like these direct interactions between components that should not even know about each other. On the other hand – earlier this week I could not find out how to make components work together at all – not even in a not-so-nice-way. I decided to drop Geertjan Wielenga an email ; he is from Oracle and is one of the leading bloggers on Oracle JET. I asked him on his thoughts on a ‘client side event bus’ in JET. It turned out that he had just (as in a few minutes prior to my email) published two articles on his blog that touched on this subject. They describe how modules and template specific view models could interact in a KnockOut application such as Oracle JET. That was a great starting point. From there, I soon Googled my way into a pretty, nifty, little KnockOut extension called Postbox, introduced in 2012 and last updated in the Summer of 2015. It turns out this extension provides the event bus for client side events – in a very simple way.
The very short story:
- Anyone can publish to these global topics (Observables can even be tied directly to a topic, so every value change is immediately published)
- When a message is published to a global topic, all subscribers are notified: subscribed observables are immediately updated with the published value and any subscribed functions are invoked with the published value as a parameter
This sounds simple (I hope) and it is!
In this article I will apply the Postbox mechanism to the HRM application I worked on in my previous article with Departments and Employees synchronization (Master – Detail synchronization in an Oracle JET rich client application against a REST API)
The end result will be the following interaction chain: Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.