What problem does this solve? Can't you just simply declare the "loosely coupled" methods as functions and call them wherever needed in vanilla javascript? Perhaps I'm missing something but judging by the examples, and assuming the messages are local to a particular process, I don't see why would you do this:
msngr.register({ topic: "Save", category: "Profile", dataType: "application/json" }, function (payload) {
console.log("Save profile information here");
});
msngr.emit({ topic: "Save", category: "Profile", dataType: "application/json" }, {
name: "Kris",
country: "United States"
});
Rather than:
function saveProfile(payload) {
console.log("Save profile information here");
}
saveProfile({
name: "Kris",
country: "United States"
});