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
This library accepts a code location (in the form of a [StackFrame](https://github.com/stacktracejs/stackframe)) and
6
6
returns a new StackFrame with a more accurate location (using [source maps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/)) and guessed function names.
7
7
8
+
This is primarily a browser-centric library, but can be used with node.js. See the [Offline Usage section](#offline-usage) below.
9
+
8
10
## Usage
9
11
```js
10
12
var stackframe =newStackFrame({fileName:'http://localhost:3000/file.min.js', lineNumber:1, columnNumber:3284});
@@ -17,15 +19,34 @@ var gps = new StackTraceGPS();
17
19
18
20
// Pinpoint actual function name and source-mapped location
var sourceCache = {'http://localhost:9999/file.min.js':'var foo=function(){};function bar(){}var baz=eval("XXX");\n//# sourceMappingURL=file.js.map'};
43
+
var sourceMap ='{"version":3,"sources":["./file.js"],"sourceRoot":"http://localhost:4000/","names":["foo","bar","baz","eval"],"mappings":"AAAA,GAAIA,KAAM,YACV,SAASC,QACT,GAAIC,KAAMC,KAAK","file":"file.min.js"}';
44
+
var sourceMapConsumerCache = {'http://localhost:4000/file.js.map':newSourceMap.SourceMapConsumer(sourceMap)};
45
+
46
+
var gps =newStackTraceGPS({offline:true, sourceCache: sourceCache, sourceMapConsumerCache: sourceMapConsumerCache});
0 commit comments