触发 Rebol 控制台的关闭事件?

发布于 2024-09-12 16:32:14 字数 47 浏览 0 评论 0原文

如何在退出控制台之前触发 Rebol 控制台的关闭事件以执行一些自定义处理程序?

How to trigger close event for Rebol Console to execute some custom handler before one quit the console ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

纵情客 2024-09-19 16:32:14

好吧,我不明白你为什么需要这个。如果您从控制台运行脚本,那么您的脚本肯定“知道”何时即将退出。

也许您正在经历系统关闭或类似情况?在这种情况下,您需要查看系统端口。

请参阅 http://www.rebol.org/ml-display-thread .r?m=rmlNFFJ

有关捕获不同操作系统的关闭事件的示例。

Well, I don't understand why you need this. If you're running a script from the console, then surely your script "knows" when it is about to quit.

Maybe you're after a system shutdown or similar? In that case you need to look at the system ports.

See http://www.rebol.org/ml-display-thread.r?m=rmlNFFJ

for an example of trapping the shutdown event for different OSes.

只是我以为 2024-09-19 16:32:14

AFAIK REBOL 没有为此提供钩子。如果您想使用系统端口挂钩来完成此操作,则必须运行事件循环。

如果您有想要触发的行为,我要做的第一件事就是添加一个简单的 SHUTDOWN 夹层,以替换 QUIT,并在那里完成您的工作。您可以将其视为一项功能或限制,这意味着用户可以根据需要通过使用关闭按钮来避免您的逻辑。

AFAIK REBOL doesn't offer a hook for that. And if you wanted to do it with a system port hook, you would have to have an event loop running.

If you have behavior you want to trigger, the first thing I would do is add a simple SHUTDOWN mezzanine, to replace QUIT, and do your work there. You could view that as a feature or a limitation, meaning the user can avoid your logic by using the close button if they want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文