我使用 setBreakpoint(3)
设置了一个新断点(其中 3
是行号)。
如果我想删除它,我可以使用 clearBreakpoint(3)
,但是如何删除以这种方式添加的所有断点?
最佳答案
这并不理想,但它确实有效。您可以使用以下内容 - 我将其保留为单行,因此您可以轻松复制它。注意:输出很丑陋,但它有效。
var i=500; while(i--){clearBreakpoint('/path/to/file/with/breakpoints.js', i); }
当然,首先确保将 i
= 设置为文件中的行数,或者至少是最后一行带有断点的行数,以及您自己的文件路径。注意:如果在设置断点时没有指定文件名,则可能不需要指定文件名。
为便于阅读而扩展:
var i = 500; // number of lines in file
while(i--){
// in my experiments, you *must* use the filename, but
// I had defined my filename when I set the breakpoints
clearBreakpoint('/path/to/file/with/breakpoints.js', i);
}
关于node.js - 清除 Node 调试器中的所有断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22483119/