web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.4 KiB

  1. stackframe
  2. ==========
  3. ## JS Object representation of a stack frame
  4. [![Build Status](https://img.shields.io/travis/stacktracejs/stackframe/master.svg?style=flat-square)](https://travis-ci.org/stacktracejs/stackframe)
  5. [![Coverage Status](https://img.shields.io/coveralls/stacktracejs/stackframe.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/stackframe?branch=master)
  6. [![GitHub license](https://img.shields.io/github/license/stacktracejs/stackframe.svg?style=flat-square)](https://opensource.org/licenses/MIT)
  7. [![dependencies](https://img.shields.io/badge/dependencies-0-green.svg?style=flat-square)](https://github.com/stacktracejs/stackframe/releases)
  8. [![gzip size](https://img.shields.io/badge/gzipped-0.96k-green.svg?style=flat-square)](https://github.com/stacktracejs/stackframe/releases)
  9. [![module format](https://img.shields.io/badge/module%20format-umd-lightgrey.svg?style=flat-square&colorB=ff69b4)](https://github.com/stacktracejs/stackframe/releases)
  10. [![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)
  11. Underlies functionality of other modules within [stacktrace.js](https://www.stacktracejs.com).
  12. Written 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)
  13. ## Usage
  14. ```js
  15. // Create StackFrame and set properties
  16. var stackFrame = new StackFrame({
  17. functionName: 'funName',
  18. args: ['args'],
  19. fileName: 'http://localhost:3000/file.js',
  20. lineNumber: 1,
  21. columnNumber: 3288,
  22. isEval: true,
  23. isNative: false,
  24. source: 'ORIGINAL_STACK_LINE'
  25. evalOrigin: new StackFrame({functionName: 'withinEval', lineNumber: 2, columnNumber: 43})
  26. });
  27. stackFrame.functionName // => "funName"
  28. stackFrame.setFunctionName('newName')
  29. stackFrame.getFunctionName() // => "newName"
  30. stackFrame.args // => ["args"]
  31. stackFrame.setArgs([])
  32. stackFrame.getArgs() // => []
  33. stackFrame.fileName // => 'http://localhost:3000/file.min.js'
  34. stackFrame.setFileName('http://localhost:3000/file.js')
  35. stackFrame.getFileName() // => 'http://localhost:3000/file.js'
  36. stackFrame.lineNumber // => 1
  37. stackFrame.setLineNumber(325)
  38. stackFrame.getLineNumber() // => 325
  39. stackFrame.columnNumber // => 3288
  40. stackFrame.setColumnNumber(20)
  41. stackFrame.getColumnNumber() // => 20
  42. stackFrame.source // => 'ORIGINAL_STACK_LINE'
  43. stackFrame.setSource('NEW_SOURCE')
  44. stackFrame.getSource() // => 'NEW_SOURCE'
  45. stackFrame.isEval // => true
  46. stackFrame.setIsEval(false)
  47. stackFrame.getIsEval() // => false
  48. stackFrame.isNative // => false
  49. stackFrame.setIsNative(true)
  50. stackFrame.getIsNative() // => true
  51. stackFrame.evalOrigin // => StackFrame({functionName: 'withinEval', lineNumber: ...})
  52. stackFrame.setEvalOrigin({functionName: 'evalFn', fileName: 'anonymous'})
  53. stackFrame.getEvalOrigin().getFunctionName() // => 'evalFn'
  54. stackFrame.toString() // => 'funName(args)@http://localhost:3000/file.js:325:20'
  55. ```
  56. ## Browser Support
  57. [![Sauce Test Status](https://saucelabs.com/browser-matrix/stacktracejs.svg)](https://saucelabs.com/u/stacktracejs)
  58. ## Installation
  59. ```
  60. npm install stackframe
  61. bower install stackframe
  62. https://raw.githubusercontent.com/stacktracejs/stackframe/master/dist/stackframe.min.js
  63. ```