Zelkova Api Documentation

Version: 0.4.0

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.

delay

(delay ms sig)

Delay a signal by ms milliseconds.

every

(every ms)

Takes a time interval ms. The resulting signal is the current time, updated every ms milliseconds.

every-channel-fn

(every-channel-fn ms)

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.

fps-channel-fn

(fps-channel-fn n)

in-hours

(in-hours ms)

in-milliseconds

(in-milliseconds ms)

in-minutes

(in-minutes ms)

in-seconds

(in-seconds ms)

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).