2 ms·
I wish I had some examples in my repo (still considering this more of a beta so I'll get to it eventually) but the big thing for me is the separation with descr
by BinaryIdiot 12y ago
I wish I had some examples in my repo (still considering this more of a beta so I'll get to it eventually) but the big thing for me is the separation with descriptive meta data.
The idea behind this is so you can create message receivers that can respond to a variety of items without even knowing the origin. Much like Android intents where intents can come from internally or externally these messages can be handled the same way (hence my primary use case is using them with web components; I can make a web component publish specific messages and have my business logic handle them without ever touching anything in the UI layer).
I started working on an experiment where I wrote two controllers that handled the UI with msngr.bind(), one for a web browser and one for a native application using node-qt (which is basically a dead project now and one of the reasons I never finished my experiment but I digress). The business logic never had to chance at all but the controllers could be swapped.
It's not hugely different than your example but I like the separation and descriptiveness it gives me. I also have plans to eventually revisit old code I have written where messages can cross web browser windows and the client-server boundary but not sure when I'll get to that.
Hope that helps!