marcantoineg / go-reacto

Reactive in Go 🍤

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-reacto   CI  

Reactive in Go or something


p := goreacto.Publisher[int]{}

p.Subscribe(func(i int) { println(i) })

mapped_p := goreacto.Map(&p, func(i int) string {
  return fmt.Sprintf("map block got value: %d", i)
})

mapped_p.Subscribe(func(s string) { println(s) })

p.Publish(1)
p.Publish(2)
p.Publish(3)

// would output
// 1
// map block got value: 1
// 2
// map block got value: 2
// 3
// map block got value: 3

About

Reactive in Go 🍤


Languages

Language:Go 100.0%