func (m *Module) click(e bar.Event) {
	current := m.count.Get().(int)
	switch e.Button {
	case bar.ButtonLeft, bar.ScrollDown, bar.ScrollLeft, bar.ButtonBack:
		current--
	case bar.ButtonRight, bar.ScrollUp, bar.ScrollRight, bar.ButtonForward:
		current++
	}
	m.count.Set(current)
}
Click handles clicks on the module output.
package counter  
import (
	"barista.run/bar"
	"barista.run/base/value"
	l "barista.run/logging"
	"barista.run/outputs"
)
type Module struct {
	count  value.Value  
	format value.Value  
}
func New(format string) *Module {
	m := &Module{}
	l.Register(m, "format", "count")
	m.count.Set(0)
	m.format.Set(format)
	return m
}
func (m *Module) Stream(s bar.Sink) {
	count := m.count.Get().(int)
	countSub, done := m.count.Subscribe()
	defer done()
	format := m.format.Get().(string)
	formatSub, done := m.format.Subscribe()
	defer done()
	for {
		s.Output(outputs.Textf(format, count).OnClick(m.click))
		select {
		case <-countSub:
			count = m.count.Get().(int)
		case <-formatSub:
			format = m.format.Get().(string)
		}
	}
}
func (m *Module) Format(format string) *Module {
	m.format.Set(format)
	return m
}