简体   繁体   English

如何在单击第三方按钮时设置断点?

[英]How to set a breakpoint on clicking a 3rd party button?

I'm trying to debug a 3rd party widget ( +1 button to be exact). 我正在尝试调试第3方小部件(准确地说是+1按钮 )。 Specifically, I'd like to set a breakpoint in Chrome that stops when a button in the widget is clicked. 具体来说,我想在Chrome中设置一个断点,该断点将在单击小部件中的按钮时停止。

I would like to break on the 3rd party code that handles to click event. 我想谈谈处理click事件的第三方代码。 Is there a Chrome extension (or something else I haven't thought of) to help me find the right place in the code to break on? 是否有Chrome扩展程序(或其他我没有想到的扩展程序)可以帮助我在代码中找到合适的位置进行扩展?

You can make use of Chrome's Developer Tools; 您可以使用Chrome的开发者工具; no extension is required. 不需要扩展名。

I made a +1 button example here: http://jsfiddle.net/rPnAe/ . 我在此处制作了一个+1按钮示例: http : //jsfiddle.net/rPnAe/

If you go to that fiddle and then open Developer Tools (F12), then go to Scripts and expand Event Listener Breakpoints and lastly expand 'Mouse' and tick the 'click' checkbox, then whenever you click somewhere (which includes an event listener), the debugger will now break at the line of code which contains the listener function. 如果转到该小提琴然后打开开发人员工具(F12),则转到“脚本”并展开“事件侦听器断点”,最后展开“鼠标”并勾选“单击”复选框,然后无论何时单击某处(包括事件侦听器) ,调试器现在将在包含侦听器功能的代码行处中断。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM