什么是“退出”?处理程序用于?
我知道所有基本处理程序,即运行
、打开
和重新打开
。但是这个处理程序,on quit
,让我感到困惑。我的问题是,它有什么用以及如何触发?
I know all of the basic handlers, i.e. on run
, on open
, and on reopen
. But this handler, on quit
, confuses me. My questions are, what is it used for and how is it triggered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
on quit
用于已保存为独立应用程序的脚本。用户可以使用其菜单退出此类脚本。当用户退出脚本时,quit
处理程序就会运行,并且可以弹出一个确认对话框,询问他们是否确定确实要退出,或者清理它创建的任何临时文件等。脚本在结束之前需要做的事情。当您完成想做的事情后,继续退出
以实际允许脚本退出。通常与空闲处理程序一起使用,因为具有此类处理程序的脚本可以长时间保持打开状态,并且用户可能需要某种方式退出它们。
on quit
is used in scripts that have been saved as a standalone application. The user can quit such a script using its menus. Aquit
handler runs when the user quits the script, and can put up a confirmation dialog asking if they are sure they really want to quit, or clean up any temporary files it created, etc. -- anything the script needs to do before it ends. When you have finished doing whatever it is you want to do,continue quit
to actually allow the script to exit.Often used with an
on idle
handler, as scripts with such a handler can stay open for long periods of time and the user may need some way to exit them.on quit
是一个允许您在退出时执行某些操作的函数。要触发它,只需使用quit
即可。例如,如果我想对用户说“感谢您尝试这个!”然后我会这样做:这会显示一个对话框,然后它会继续退出。但是,如果我想取消退出,我会删除
continue quit
行。希望这应该是有道理的。
on quit
is a function that allows you to do something on quit. To trigger it, simply usequit
. For example, if I wanted to say to the user "Thanks for trying this!" then I'd do this:Which would display a dialog, then it would continue quitting. But, if I wanted to cancel quit, I'd remove the
continue quit
line.Hopefully this should make sense.