Reputation: 105
Is there a way to trace custom events, specially those non-DOM events like in backbone?
thisObj.on("custom:triggeredEvents", function() { do.stuffHere() });
thisObj.trigger("custom:triggeredEvents");
Cheers!
Upvotes: 0
Views: 194
Reputation: 1901
You should have a look at the observer pattern.
If you don't want to implement this by yourself, you can use existing libraries, e.g. https://github.com/mroderick/PubSubJS
Upvotes: 2