Skip to content

Commit ac85cf5

Browse files
committed
Improve docs for instrument(). Fixes #151
1 parent ae92d1b commit ac85cf5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@ StackTrace.generateArtificially().then(callback).catch(errback)
5454

5555
#### Trace every time a given function is invoked
5656
```js
57-
// callback is called with an Array[StackFrame] every time
58-
// the wrapped interestingFn is called
59-
StackTrace.instrument(interestingFn, callback, errback)
57+
// callback is called with an Array[StackFrame] every time wrapped function is called
58+
var myFunc = function(arg) { return 'Hello ' + arg; }
59+
var myWrappedFunc = StackTrace.instrument(myFunc, callback, errback)
6060
=> Instrumented Function
61+
myWrappedFunc('world');
62+
=> 'Hello world'
6163

62-
StackTrace.deinstrument(interestingFn)
64+
// Use this if you overwrote you original function
65+
myFunc = StackTrace.deinstrument(myFunc)
6366
=> De-instrumented Function
6467
```
6568

@@ -147,6 +150,8 @@ I recommend the [stack-trace node package](https://www.npmjs.com/package/stack-t
147150
It has a very similar API and also supports source maps.
148151

149152
## Contributing
153+
This project adheres to the [Open Code of Conduct](http://todogroup.org/opencodeofconduct/#stacktrace.js/me@eriwen.com). By participating, you are expected to honor this code.
154+
150155
Want to be listed as a *Contributor*? Start with the [Contributing Guide](https://github.com/stacktracejs/stacktrace.js/blob/master/CONTRIBUTING.md)!
151156

152157
This project is made possible due to the efforts of these fine people:

0 commit comments

Comments
 (0)