Pausing code execution in chrome from JS. Possible?

Is it possible to pause execution from JS code? I am working on a simple haxe-based debugging utility, and I want to be able to simulate breakpoints by calling the util method, which will start a pause of execution.

+6
source share
1 answer

Not sure if this is what you are looking for, but in Chrome (and Firefox if Firebug is installed) you can use the built-in JavaScript debugger . This causes execution to pause, and it is as efficient as setting a breakpoint. For example, the following will be broken at each iteration of the loop: you can check the value of i (a stupidly simple example):

 for(var i = 0; i < 10; i++) { debugger; console.log(i); } 
+15
source

Source: https://habr.com/ru/post/901931/


All Articles