Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause script execution in Developers console

I'm trying to create a rotating banner (JavaScript & CSS). For debugging and making changes on the CSS etc in the developers' console, I want to pause the JavaScript execution while I make changes and then run it or so on. So, is there a way to pause the script execution in the browser?

like image 852
ptamzz Avatar asked Dec 06 '11 07:12

ptamzz


People also ask

How do I stop code from running in console?

The caret (^) means Ctrl. So basically, the terminal shows the Ctrl+C keystrokes as ^C. The Ctrl+C works very well for the commands that are designed to keep on running until interrupted. You feel like you have to cancel the command, use Ctrl+C.

How do you pause a console log?

On the debugger pane expand the view of the “Event Listener Breakpoints”. From there, expand “Mouse”. Then checkmark the 'click' button. Now when you click the Calculate Bill button, the debugger will pause execution on the first line of the first function “onClick()”.


2 Answers

You are looking for "breakpoints".

Which browser are you using?

Chrome supports breakpoints right away in its developer tools:
F12 (or Ctrl-Shift-I), "Script" tab, select script from dropdown, click the line number.
Update:
On PC: F12 or Ctrl+Shift+I / On Mac: Cmd+Alt+I
select "Sources" tab, select script from the file pane on the left, click the line number.

In Firefox use the Firebug extension:
On PC and Mac: F12,
"Script" tab, activate & reload if needed, select script from dropdown, click line number.

When your Javascript pauses at a breakpoint, both browsers offer you the usual debugging tools to single step through the code, inspect & change variable values, watch expressions,...

like image 53
Jpsy Avatar answered Oct 14 '22 10:10

Jpsy


As katspaugh mentions in their comment:

F8

This only works for me from the Sources tab of the Developer Tools window in Chrome 59.0.3071.115 (on Mac OS X).

like image 38
Kenny Evitt Avatar answered Oct 14 '22 08:10

Kenny Evitt