15. • Now at 5 contributors
• 130+ watchers on GitHub
16. Coming soon...
• IE9 support
• Function instrumenting to always
print a stacktrace when called (done!)
• Real-time traces (maybe! - not as easy
as you think ;)
Do you write any JavaScript? Does your web app have to behave in Internet Explorer?
This is a Javascript developer’s nightmare. Don’t you love IE?
Open up Firebug, try to reproduce the bug... and come to the realization that you’ll have to debug it in IE.
Unfortunately, the developer tools available for IE aren’t always that helpful. At this point you’re reduced to console.log statements or even... *gasp* alerts.
What if you had a way of knowing what was called leading up to the error automatically?
An array of strings containing function names, files, line numbers and arguments
Obviously this project is open-source or I wouldn’t be speaking to you tonight.
So you have no excuses not to use it!
Javascript Stacktrace works in LOTS of browsers. I have tested it as working in IE 5.5 up, and all the other browsers you see here... probably many of which you may have never heard of
The secret sauce here is that every function has a reference to it’s calling function, that every function maintains a reference to passed parameters
Good browsers have Error objects that have a function stack complete with files and line numbers!
3 simple steps to get this working: Include stacktrace.js, call printStackTrace() and do whatever you want with it.
In the previous example I called it within window.onerror
You can’t get everything in all circumstances. Only gives you where the problem is, not what. Not interactive without a console.
However, it is one more tool in your toolbox, and it turns out a bunch of people think it’s useful enough.
I know a lot of you attended my talk in February, so for you I have a sneak peek of things to come
I learned a lot about how to manage open-source projects themselves, and I wanted to share a few secrets that I think apply to all projects
It turns out it usually doesn’t matter HOW you do it as long as you fulfill a need.
Using QUnit for unit testing and Browsershots.org to test lots of browsers visually encouraged everyone to make code tweaks without fear!
I, myself, am guilty of not releasing projects because I was afraid of looking stupid and having my code laughed at. It is *always* worth it to publicize it, anyway. You are guaranteed to learn a lot
Now go check out the project! Hit the shortlink here or just Google “Javascript Stacktrace” and it’s the first result!