Giter VIP home page Giter VIP logo

debugjs's Introduction

debugjs

Lightweight JavaScript VM and stepping debugger in JavaScript.
Demo app
Blog post

Installation

With component(1):

$ component install amasad/debugjs

With npm

$ npm install amasad/debugjs

Or grab dist/bundle.js for a standalone library.

API

debugjs.createDebugger(options)

Creates and returns a Debugger. options will be passed to the Machine constructor. options.sandbox will be passed as the sandbox option -- see Machine

Debugger

new Debugger(machine)

Creates a Debugger on top of the passed machine.

Debugger#addBreakpoints(filename, linenos)

filename string of the filename. liennos array of linenumbers to add breakpoints to.

Debugger#removeBreakpoint(filename, linenos)

filename string of the filename. liennos array of linenumbers to remove breakpoints to.

Debugger#getBreakpoints(filename)

Gets an array of breakpoints on the file filename.

Debugger#getCallStack(options)

Gets a sanitized call stack, with nothing but stack frames. Pass in { raw: true } to get meta call stack info.

Debugger#run()

Runs the code until it hits a breakpoint.

Debugger#stepOver()

Steps over an instruction.

Debugger#stepIn()

Steps into a function call.

Debugger#stepOut()

Steps out of a function call.

Debugger#load(code, filename)

Loads a file of code into the machine.

Debugger#paused()

Boolean for if the machine is paused.

Debugger#halted()

Boolean for if the machine is halted.

Debugger#getCurrentStackFrame()

Current stsack frame.

Machine

new Machine(sandbox, options)

sandbox object with references to be copied into the context. options:

  • iframeParentElement to attach the context iframe to a parent element

Machine#evaluate(code, filename)

Compiles code as file filename and gets it ready to run.

Machine#step()

Steps through the evaluateed code.

Machine#run()

Calls step continuously until machine is halted

Machine#pause()

Will not let run() do anymore steps.

Machine#resume()

run() could continue running.

Machine#getCallStack()

Gets the call stack. Note that this will include meta call stack information, like thunks etc. See Debugger#getCallStack on how to filter non stack frame information.

Machine#getCurrentStackFrame()

Gets the current stack frame

Machine#getState()

Returns an object the latest step information (whether halted and what was yielded).

Machine#getCurrentLoc()

Line and column of the latest instruction ran by the machine.

Machine#paused

Boolean stating if the machine is paused. See pause()

Machine#halted

Boolean stating if the machine has no more instructions to run and is in idle state.

License

AAL. See LICENSE

debugjs's People

Contributors

amasad avatar istarkov avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.