forked from stacktracejs/stacktrace.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.json
More file actions
1 lines (1 loc) · 2.14 KB
/
params.json
File metadata and controls
1 lines (1 loc) · 2.14 KB
1
{"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"}