A Quick Note On Pub-Sub / Event Aggregators In WinJS/WinRT

By now you know that I’m a fan of pub-sub / event aggregators, whether it’s .NET / Winforms or Backbone or whatever. For the last 3 weeks working on this WinJS / WinRT app with the Microsoft P&P group, I’ve had this thought that I want to do the same thing in WinJS / WinRT apps. Only I couldn’t figure out how. @Bennage and I had several discussions on this and decided to look in to it later. Well today was “later” apparently, and thanks to the Chris Tavares I found these wonderful little nuggets of awesome:

WinJS.Application.queueEvent – queue an event to be sent

WinJS.Application.addEventListener – handle an event that was sent

Of course this is only an application level event aggregator. If I want to use localized / sub-application / module event aggregators, I need to find another way to make that happen. I have some leads on this, but haven’t had a chance to work on them yet. I have hope, though, and this is yet another reason that I really like working on WinJS apps.

Partially Applied Functions In JavaScript