我可以 console.debug() 并在那里设置 Chrome 开发工具断点吗?
Can I console.debug() and make Chrome Dev-tools breakpoint there?
我可以从我的代码中手动设置断点吗(比如在那个点写 console.debug)。
调试缓存问题,在我第一次加载它时断点很重要。如果我必须添加一个断点然后重新加载,我无法测试缓存(第一次加载时未定义函数的问题,但随后工作)。
参见google documentation。只需在代码中写入 debugger
,Chrome 将在那里暂停执行。
Manual breakpoints are individual breakpoints that you set on a specific line of code. You can set these via the Chrome DevTools GUI, or by inserting the debugger keyword in your code.
您可以覆盖 console.debug
并在那里设置 debugger
,因此我们可以将其更改为以下
var debugCopy = console.debug.bind(console)
console.debug = function(){
debugger;
return debugCopy.apply(console,arguments)
}
我可以从我的代码中手动设置断点吗(比如在那个点写 console.debug)。
调试缓存问题,在我第一次加载它时断点很重要。如果我必须添加一个断点然后重新加载,我无法测试缓存(第一次加载时未定义函数的问题,但随后工作)。
参见google documentation。只需在代码中写入 debugger
,Chrome 将在那里暂停执行。
Manual breakpoints are individual breakpoints that you set on a specific line of code. You can set these via the Chrome DevTools GUI, or by inserting the debugger keyword in your code.
您可以覆盖 console.debug
并在那里设置 debugger
,因此我们可以将其更改为以下
var debugCopy = console.debug.bind(console)
console.debug = function(){
debugger;
return debugCopy.apply(console,arguments)
}