I'm creating an events object using a bit of backbone and underscore as follows:
var appEvents = _.extend({}, Backbone.Events);
I'm then trying to create a function that will console.log all and any event triggered to this object, regardless of where, how or what listeners it has, but am kinda unsure how I'd do that. I'm still experimenting with Backbone.
I think using the listenTo method is the way to go... but again, not sure how I'd implement that.
appEvents
is working properly. I can doappEvents.trigger('event')
just fine. What I'm trying to do is to somehow see in my console those events when they are triggered. So say I have an event called "openModal" being triggered when I click on a link, I'd like to have aconsole.log
with the name "openModal" when I click that link that somehow works automatically whenappEvents.trigger
is called.