反应 - 香蕉时间延迟 [英] reactive-banana time delays

查看:135
本文介绍了反应 - 香蕉时间延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了反应香蕉的文档,我找不到明确指定的方法时间延迟。比方说,我想采取一个事件t a 并将其所有事件在未来1秒内转移;或从现在开始发生1秒钟的事件(在瞬间t 内);或类似的东西。反应式香蕉中是否有明确的延迟?如果没有,用户如何实现,例如,将输入延迟一秒钟? 正如本指出的,这是正确的:反应型香蕉不是固有的时间和延迟概念。

主要原因是很难保证逻辑时间和实时性是一致的。当一个事件的逻辑时间尚未计算出来,即其实际时间在其逻辑时间后面减少时,实时发生鼠标点击会发生什么?然而, ,仍然有可能通过使用外部计时器事件来处理时间。查看 Wave.hs 示例。


I have scoured the documentation of reactive-banana, and I can't find a way to specify explicit time delays. Say, for example, I would like to take an Event t a and shift all of its occurrences 1 second into the future; or get an event that fires 1 second from now (within Moment t); or anything like that. Are explicit delays representable in reactive-banana? If not, how do users implement, e.g., echoing input delayed by a second?

解决方案

As Ben indicates, this is correct: reactive-banana is no built-in notion of time and delays.

The main reason is that it is hard to guarantee that logical time and real time agree. What happens when a mouse click happens in real time before the logical time of an event which could not yet be calculated, i.e. whose real time dallies behind its logical time?

However, it is still possible to deal with time by using external timer events. Have a look at the Wave.hs example.

这篇关于反应 - 香蕉时间延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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