Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Display of Function Watches #3

Closed
pbininda opened this issue Jul 6, 2012 · 5 comments
Closed

Display of Function Watches #3

pbininda opened this issue Jul 6, 2012 · 5 comments

Comments

@pbininda
Copy link

pbininda commented Jul 6, 2012

Hi,
in my project time recorder application (http://www.sekas.de/ptr), I use quite a few watches with function expressions as the first argument.
For anonymous functions, the batarang just displays function() in the performance tab. A file name/line number pair would be great for identifying these functions.

@ajoslin
Copy link

ajoslin commented Jul 9, 2012

You could also try naming your $watch functions, eg:

scope.$watch(function watchThat() { 
  return that(); 
}, function whenThatChanges(newValue, oldValue) {
});

Batarang will probably give you the function names.

@xzachtli
Copy link

Since Coffeescript does not allow compiling named functions as suggested by ajoslin, I also would like to see functionality allowing me to click on a function in the performance tab and be taken to the Sources (not Resources) tab to view the line/function in question. Similar to functionality when you click on something like "script.js:10" in the console after doing a console.log.

@btford
Copy link
Contributor

btford commented Jul 15, 2012

Great ideas, guys. I'm looking into all of those things now.

I'm not entirely sure how possible it is to get the line number of a function declaration in Chrome. I found this interesting method to get line numbers by throwing exceptions, but that seems a bit hackish and would require extensive instrumentation.

@btford
Copy link
Contributor

btford commented Nov 14, 2012

Update: when using the Batarang, it's best to use the un-minified version of AngularJS, which has more instructive watch function names that Batarang knows how to display.

I'm considering including a mapping of the minified name to a useful, debug-able name in another version of Angular, but such a mapping would need to be created for each and every version of AngularJS (which is tedious to maintain).

@btford
Copy link
Contributor

btford commented Jan 1, 2013

Added a note to the FAQ: https://github.com/angular/angularjs-batarang/blob/master/FAQ.md

I think in the long term, it would be interesting to incorporate sourcemaps for debugging coffeescript/minified apps. If someone needs/wants such a feature, please file a new issue.

Closing this one.

@btford btford closed this as completed Jan 1, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants