Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save peterli888/e2f193fdeb4da6c9a1254f81adc64332 to your computer and use it in GitHub Desktop.
Save peterli888/e2f193fdeb4da6c9a1254f81adc64332 to your computer and use it in GitHub Desktop.
如何更好地跟踪匿名函数的错误
from: https://github.com/montagejs/mr/blob/master/browser.js
// Here we use a couple tricks to make debugging better in various browsers:
// TODO: determine if these are all necessary / the best options
// 1. name the function with something inteligible since some debuggers display the first part of each eval (Firebug)
// 2. append the "//# sourceURL=location" hack (Safari, Chrome, Firebug)
// * http://pmuellr.blogspot.com/2009/06/debugger-friendly.html
// * http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
// TODO: investigate why this isn't working in Firebug.
// 3. set displayName property on the factory function (Safari, Chrome)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment