group/Cycling
godocimport "barista.run/group/cycling"
Create a group that cycles through modules: grp, ctrl := cycling.Group(duration, ...)
.
The returned group is a bar.Module
and can be added to the bar directly. The second return value
is a Controller
that can set the refresh interval programmatically. If you only set the interval
during construction, you can ignore it: grp, _ := cycling.Group(duration, ...)
.
Example
c
b
a
A simple example of a group that shows each module for 2 seconds.
// For simplicity, assuming a, b, c are simple text modules that show 'a', 'b', and 'c'.
grp, _ := cycling.Group(2 * time.Second, a, b, c)
barista.Run(grp)
Controller
SetInterval(time.Duration)
: changes the cycling interval.