Adding Logging To Objects With Help Of Metaprogramming
Let’s say you want to modify the behaviour of an existing Backbone view.
Have you ever had this feeling. You look at someone’s code. And you’re just trying to understand, what’s happening there. What methods are being invoked, and in what particular order. Wouldn’t it be nice if Backbone could log every method being invoked into console, maybe with some meta information like when it started, when it finished, how long did it take, etc.?
Well, there’s a really easy way to do this.
Let’s say, we have a Backbone view with several binded events, lot’s...
Continue reading →