Git Product home page Git Product logo

devtool-examples's Introduction

devtool-examples

Some examples of using devtool for a short talk/presentation at @nodeschool Toronto.

Intro

devtool is a new command-line tool for debugging, developing and profiling Node applications built on Electron. We will also explore some novel use cases here, blending browser and Electron APIs.

Usage

Clone this module and install devtool globally:

git clone https://github.com/Jam3/devtool-examples.git
cd devtool-examples
npm install

# also grab devtool globally
npm install -g devtool

Hello World

If you git clone this repo, you can use npm run to execute commands. Or you can install devtool globally and use it directly in shell.

npm run repl

Open a REPL with Node.js support:

devtool

repl

npm run hello

Open the "Hello, World!" script in devtool:

devtool hello-world.js

Or with console redirection:

devtool hello-world.js --console

Or with file watching, for development:

devtool hello-world.js --watch

Debugging / Profiling Node

npm run http

To debug an HTTP server:

devtool http.js --console --watch

Then try setting a breakpoint in one of the request handlers and loading http://localhost:8080/.

breakpoint

Browser APIs

npm run audio

Command-line app to convert MP3/OGG/etc to MP3 audio files:

devtool to-wav.js -qh < audio.mp3 > audio.wav

npm run canvas:dev

Using the <canvas> API to programmatically render an image.

The development version shows a browser and DevTools window, renders the canvas to the DOM, and reloads on file save.

NODE_ENV=development devtool canvas.js --watch --show

npm run canvas

The production version renders the canvas as a PNG file and writes it to process.stdout, without showing any GUI.

devtool canvas.js --quit --headless > image.png

Result:

canvas

Other Ideas

Other use cases:

  • Debugging Gulp/Grunt scripts
  • Web Speech (synthesis, recognition)
  • Geolocation
  • User Media (audio/video recording)
  • Electron APIs like browserWindow.capturePage

See Also

More inspiration built on top of Electron, which devtool could also be used for.

devtool-examples's People

Contributors

mattdesl 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.