DEV Community

Cover image for Testing
sukhrobabdullaev
sukhrobabdullaev

Posted on

Testing

call stack

what is it .

How does this work?

Loupe runs entirely in your browser.
It takes your code.

  • Runs it through esprima, a JS parser.
  • Instruments it a bunch so that loupe knows where function calls, timeouts, dom events, etc happen.
  • Adds a whole bunch of while loops everywhere to slow down the code as it runs. This modified code is then turned back into JavaScript and sent to a webworker (in your browser) which runs it. As it runs, the instrumentation sends messages to the visualisation about what is going on so it can animate things at the right time. It also has some extra magic to make dom events, and timers work properly.
$.on('button', 'click', function onClick() {
    setTimeout(function timer() {
        console.log('You clicked the button!');    
    }, 2000);
});

console.log("Hi!");

setTimeout(function timeout() {
    console.log("Click the button!");
}, 5000);

console.log("Welcome to loupe.");
Enter fullscreen mode Exit fullscreen mode

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay