source: imaps-frontend/node_modules/stackframe/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[d565449]1stackframe
2==========
3## JS Object representation of a stack frame
4
5[![Build Status](https://img.shields.io/github/workflow/status/stacktracejs/stackframe/Continuous%20Integration/master?logo=github&style=flat-square)](https://github.com/stacktracejs/stackframe/actions?query=workflow%3AContinuous+Integration+branch%3Amaster)
6[![Coverage Status](https://img.shields.io/coveralls/stacktracejs/stackframe.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/stackframe?branch=master)
7[![GitHub license](https://img.shields.io/github/license/stacktracejs/stackframe.svg?style=flat-square)](https://opensource.org/licenses/MIT)
8[![dependencies](https://img.shields.io/badge/dependencies-0-green.svg?style=flat-square)](https://github.com/stacktracejs/stackframe/releases)
9[![gzip size](https://img.shields.io/badge/gzipped-0.96k-green.svg?style=flat-square)](https://github.com/stacktracejs/stackframe/releases)
10[![module format](https://img.shields.io/badge/module%20format-umd-lightgrey.svg?style=flat-square&colorB=ff69b4)](https://github.com/stacktracejs/stackframe/releases)
11[![code of conduct](https://img.shields.io/badge/code%20of-conduct-lightgrey.svg?style=flat-square&colorB=ff69b4)](http://todogroup.org/opencodeofconduct/#stacktrace.js/me@eriwen.com)
12
13Underlies functionality of other modules within [stacktrace.js](https://www.stacktracejs.com).
14
15Written to closely resemble StackFrame representations in [Gecko](http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nsIException.idl#14) and [V8](https://github.com/v8/v8/wiki/Stack%20Trace%20API)
16
17## Usage
18```js
19// Create StackFrame and set properties
20var stackFrame = new StackFrame({
21 functionName: 'funName',
22 args: ['args'],
23 fileName: 'http://localhost:3000/file.js',
24 lineNumber: 1,
25 columnNumber: 3288,
26 isEval: true,
27 isNative: false,
28 source: 'ORIGINAL_STACK_LINE'
29 evalOrigin: new StackFrame({functionName: 'withinEval', lineNumber: 2, columnNumber: 43})
30});
31
32stackFrame.functionName // => "funName"
33stackFrame.setFunctionName('newName')
34stackFrame.getFunctionName() // => "newName"
35
36stackFrame.args // => ["args"]
37stackFrame.setArgs([])
38stackFrame.getArgs() // => []
39
40stackFrame.fileName // => 'http://localhost:3000/file.min.js'
41stackFrame.setFileName('http://localhost:3000/file.js')
42stackFrame.getFileName() // => 'http://localhost:3000/file.js'
43
44stackFrame.lineNumber // => 1
45stackFrame.setLineNumber(325)
46stackFrame.getLineNumber() // => 325
47
48stackFrame.columnNumber // => 3288
49stackFrame.setColumnNumber(20)
50stackFrame.getColumnNumber() // => 20
51
52stackFrame.source // => 'ORIGINAL_STACK_LINE'
53stackFrame.setSource('NEW_SOURCE')
54stackFrame.getSource() // => 'NEW_SOURCE'
55
56stackFrame.isEval // => true
57stackFrame.setIsEval(false)
58stackFrame.getIsEval() // => false
59
60stackFrame.isNative // => false
61stackFrame.setIsNative(true)
62stackFrame.getIsNative() // => true
63
64stackFrame.evalOrigin // => StackFrame({functionName: 'withinEval', lineNumber: ...})
65stackFrame.setEvalOrigin({functionName: 'evalFn', fileName: 'anonymous'})
66stackFrame.getEvalOrigin().getFunctionName() // => 'evalFn'
67
68stackFrame.toString() // => 'funName(args)@http://localhost:3000/file.js:325:20'
69```
70
71## Browser Support
72[![Sauce Test Status](https://saucelabs.com/browser-matrix/stacktracejs.svg)](https://saucelabs.com/u/stacktracejs)
73
74## Installation
75```
76npm install stackframe
77bower install stackframe
78https://raw.githubusercontent.com/stacktracejs/stackframe/master/dist/stackframe.min.js
79```
Note: See TracBrowser for help on using the repository browser.