Google App Script Debugger无法在ClickHandler回调中使用 [英] Google App Script Debugger not working on ClickHandler callback

查看:139
本文介绍了Google App Script Debugger无法在ClickHandler回调中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了Google应用脚本教程 here 这是一个非常简单的脚本,具有两个功能。 showDialog (它提供了一个带有文本字段和提交按钮的对话框)和 respondToSubmit(e)按钮,并将输入的数据添加到电子表格中。
它可以正常工作。

I've followed the Google app script tutorial here which is a very simple script with two functions. showDialog (which presents a dialog box with a text field and submit button ) and respondToSubmit(e) which handles the submit button and adds the entered data to the spreadsheet. It works fine.

似乎没有工作的是回调中的调试器。所以我在两个函数中放置一个断点,并启动 showDialog 函数。调试器在断点处启动并停止执行。我点击继续,所以我可以与新打开的对话框进行交互。但是当我单击提交按钮时,调试器不会再次启动。执行 respondtoSubmit(e)函数。调试器不会在断点上停止。

What doesn't seem to work is the debugger on the callback. So I place a breakpoint in both functons and start the showDialog function. The debugger kicks in and stops execution at the breakpoint. I click continue so I can interact with the newly opened dialog box. However when I click the submit button the debugger does not start again. The respondtoSubmit(e) function is executed. The debugger just does not stop on the breakpoint(s).

这样调试回调有一个问题,还是只能一次调试一个函数? p>

Is there a problem with debugging callbacks like this or can you only debug one function at a time?

推荐答案

截至目前,调试器有一些意想不到的行为。大多数情况下,它只是在脚本编辑器调用过程中只能断言断点,所以要调试你必须从调试器而不是UI调用它的事件处理程序。如果您需要查看传递给函数的事件对象等变量,例如,尝试将此行添加到通常放置断点的处理程序中:
Logger.log( Utilities.jsonStringify(e));
执行后,从脚本编辑器中查看日志。

As of right now, the debugger has some unexpected behaviours. Mostly, it seems to only respect breakpoints during calls from the script editor, so to debug your event handler you must call it from the debugger, not the UI. If you need to peek into variables such as the event object passed to the function, for example, try adding this line to your handler where you'd normally put a breakpoint: Logger.log(Utilities.jsonStringify(e)); Then view the log from the script editor after execution.

这篇关于Google App Script Debugger无法在ClickHandler回调中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆