Hacker News new | ask | show | jobs
by GeneralMayhem 4708 days ago
My favorite trick along those lines:

  var cache = SomeClass.prototype.someMethod;
  SomeClass.prototype.someMethod = function () {
    debugger; // or `throw "stacktrace"`
    cache.apply(this, arguments)
  }
Inserts a stack trace right in the middle of executing someone else's code, which is nice for tracking down why/when that function gets called if documentation is poor, without changing functionality.