Interactive REPL for debugging Electron programs.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

readme.md

electron-repl stability

Interactive REPL for debugging Electron programs.

npm travis standard downloads

About

Run an electron program but also attach a REPL to the same context that your code runs in so you can inspect and mess with stuff as your program is running!

This is alpha quality and not guaranteed to work with complex programs! Please report issues and contribute fixes if you can.

This command-line tool is a fork of node-repl by maxogden.

Known Issues

Currently this only works with the main electron process -- relative requires don't work in the renderer thread and things just explode in there. If you think you know a fix please let us know!

Usage

$ npm i -g electron-repl
$ electron-repl
Usage: electron-repl <filename>

$ electron-repl your-program.js
>

If you have npm@5.2+ installed, you can just do:

$ npx electron-repl your-program.js
>

Example

Suppose we have a program called hello.js that has these contents:

var pizza = 1

If you run electron-repl hello.js you will get a REPL, just like when you run electron.

The difference is that this REPL is running in the same context as your program.

$ electron-repl hello.js
> 1 + 1 // we are in an electron repl
2
> pizza // we can access variables in our program
1
>

Contributing

Contributions welcome! Please read the contributing guidelines first.

Credit

This is a fork of node-repl modified to work with electron. Almost everything in this module was originally created by maxogden and node-repl contributors. Thank you!

License

BSD