You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bac2ba1
Browse filesBrowse the repository at this point in the historyBrowse files
<li><aclass="buttons github" href="https://github.com/eriwen/javascript-stacktrace">View On GitHub</a></li>
26
+
</ul>
27
+
28
+
<pclass="header">This project is maintained by <aclass="header name" href="https://github.com/eriwen">eriwen</a></p>
29
+
30
+
31
+
</header>
32
+
<section>
33
+
<h1>What is stacktrace.js?</h1>
34
+
35
+
<p>A Javascript tool that allows you to debug your JavaScript by giving you a <ahref="http://en.wikipedia.org/wiki/Stack_trace">stack trace</a> of function calls leading to an error (or any condition you specify)</p>
36
+
37
+
<h1>How do I use stacktrace.js?</h1>
38
+
39
+
<p>Just include stacktrace.js file on your page, and call it like so:</p>
<spanclass="nx">foo</span><spanclass="p">();</span><spanclass="c1">//Will log a stacktrace when 'baz()' is called containing 'foo()'!</span>
84
+
85
+
<spanclass="nx">p</span><spanclass="p">.</span><spanclass="nx">deinstrumentFunction</span><spanclass="p">(</span><spanclass="k">this</span><spanclass="p">,</span><spanclass="s1">'baz'</span><spanclass="p">);</span><spanclass="c1">//Remove function instrumentation</span>
86
+
</pre></div>
87
+
88
+
<h1>What browsers does stacktrace.js support?</h1>
89
+
90
+
<p>It is currently tested and working on:</p>
91
+
92
+
<ul>
93
+
<li>Firefox (and Iceweasel) 0.9+</li>
94
+
<li>Google Chrome 1+</li>
95
+
<li>Safari 3.0+</li>
96
+
<li>Opera 7+</li>
97
+
<li>IE 5.5+</li>
98
+
<li>Konqueror 3.5+</li>
99
+
<li>Flock 1.0+</li>
100
+
<li>SeaMonkey 1.0+</li>
101
+
<li>K-Meleon 1.5.3+</li>
102
+
<li>Epiphany 2.28.0+</li>
103
+
<li>Iceape 1.1+</li>
104
+
</ul>
105
+
</section>
106
+
<footer>
107
+
<p><small>Hosted on <ahref="https://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p>
{"tagline":"Framework-agnostic, micro-library for getting stack traces in all web browsers","body":"# What is stacktrace.js?\r\nA Javascript tool that allows you to debug your JavaScript by giving you a [stack trace](http://en.wikipedia.org/wiki/Stack_trace) of function calls leading to an error (or any condition you specify)\r\n\r\n# How do I use stacktrace.js?\r\nJust include stacktrace.js file on your page, and call it like so:\r\n\r\n```html\r\n<script type=\"text/javascript\" src=\"path/to/stacktrace.js\" />\r\n<script type=\"text/javascript\">\r\n ... your code ...\r\n if (errorCondition) {\r\n var trace = printStackTrace();\r\n //Output however you want!\r\n alert(trace.join('\\n\\n'));\r\n }\r\n ... more code of yours ...\r\n</script>\r\n```\r\n\r\nYou can also pass in your own Error to get a stacktrace *not available in IE or Safari 5-*\r\n\r\n```javascript\r\nvar lastError;\r\ntry {\r\n // error producing code\r\n} catch(e) {\r\n lastError = e;\r\n // do something else with error\r\n}\r\n\r\n// Returns stacktrace from lastError!\r\nprintStackTrace({e: lastError});\r\n```\r\n\r\n# Function Instrumentation\r\nYou can now have any (public or privileged) function give you a stacktrace when it is called:\r\n\r\n```javascript\r\nvar p = new printStackTrace.implementation();\r\np.instrumentFunction(this, 'baz', logStackTrace);\r\nfunction logStackTrace(stack) {\r\n console.log(stack.join('\\n'));\r\n}\r\nfunction foo() {\r\n var a = 1;\r\n bar();\r\n}\r\nfunction bar() {\r\n baz();\r\n}\r\nfoo(); //Will log a stacktrace when 'baz()' is called containing 'foo()'!\r\n\r\np.deinstrumentFunction(this, 'baz'); //Remove function instrumentation\r\n```\r\n\r\n# What browsers does stacktrace.js support?\r\nIt is currently tested and working on:\r\n\r\n - Firefox (and Iceweasel) 0.9+\r\n - Google Chrome 1+\r\n - Safari 3.0+\r\n - Opera 7+\r\n - IE 5.5+\r\n - Konqueror 3.5+\r\n - Flock 1.0+\r\n - SeaMonkey 1.0+\r\n - K-Meleon 1.5.3+\r\n - Epiphany 2.28.0+\r\n - Iceape 1.1+\r\n","note":"Don't delete this file! It's used internally to help with page regeneration.","name":"stacktrace.js","google":"UA-15897750-2"}
0 commit comments