Code Monkey home page Code Monkey logo

debug's Introduction

debug.js

© James Padolsey

debug.js is an in-browser JavaScript error-reporter.

  • Runs your JavaScript through [JSLint](http://jslint.com] and shows any emerging errors.
  • Runs your JavaScript through the browser and provides feedback on runtime errors.

debug.js is not really a debugger but of great aid in the debugging process. It's not meant as a replacement for current debugging tools (such as Firebug) but more as another tool you can use to ensure that your JavaScript is "up to the mark".

Note: This is still in development; bugs expected!

Usage:

Download debug.js and include it in your document, right at the bottom:

<script src="debug.js"></script>

If no errors (syntax or runtime) exist then you won't see anything. If errors do exist then an overlay should appear which details the errors encountered.

Example:

<html>
    <head>
        <title>DEBUG DEMO</title>
    </head>
    <body>
        
        <!--JSLint Example-->
        <script>
            var regex = /ProblemWithThisRegex[123-]/
        </script>
        
        <!--RuntimeError Example-->
        <script>
            var something = nonExistingObject.property;
        </script>
        
        <script src="debug.js"></script>
        
    </body>
</html>

Output produced from the above source:

debug.js preview

Tips:

To skip a SCRIPT, simple preceed it with a comment containing just the word "skip":

<!--skip-->
<script>...</script>

To only skip the JSLint portion of the test preceed your SCRIPT with the following comment:

<!--skiplint-->
<script>...</script>

To give your SCRIPTS IDs, preceed them with comments like these: (note, don't use "skip" or "skiplint" as IDs!)

<!--foo bar-->
<script>...</script>

<!--wowza-->
<script>...</script>

(A script's ID appears alongside its report - an especially useful feature if you have many...)

debug.js works with externally hosted JavaScript files too. The only type of file it cannot reach is one stored locally on a seperate domain to the document. For example: the documents URL is http://127.0.0.1/something.html and the script is located at http://localhost/script.js - debug.js won't be able to reach this...

debug's People

Contributors

padolsey avatar

Watchers

Chuck Yang avatar James Cloos 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.