jamesmacaulay.zelkova.time
Functions for working with time.
debounce
(debounce ms sig)
Returns a signal which relays the latest value from sig
only after ms
milliseconds have passed since sig
last updated. Useful when you want to wait until a user stops typing before doing something with the text, for example.
every
(every ms)
Takes a time interval ms
. The resulting signal is the current time, updated every ms
milliseconds.
fps
(fps n)
Takes desired number of frames per second (fps). The resulting signal gives a sequence of time deltas as quickly as possible until it reaches the desired FPS. A time delta is the time between the last frame and the current frame.
since
(since ms sig)
Returns a signal of boolean values: true when sig
has updated in the past ms
milliseconds, false otherwise.
timestamp
(timestamp sig)
Add a timestamp to any signal. Returns a signal of [timestamp value]
vectors. Timestamps are tied to the origin events of a signal value, so (timestamp mouse/x)
and (timestamp mouse/y)
will always have the same timestamp because they rely on the same underlying event (mouse/position
).