filter.go 350 B

123456789101112131415161718
  1. package tg
  2. // Implementing the interface provides way
  3. // to know exactly what kind of updates
  4. // the widget needs.
  5. type Filterer interface {
  6. // Return true if should filter the update
  7. // and not send it inside the widget.
  8. Filter(*Update) bool
  9. }
  10. type FilterFunc func(*Update) bool
  11. func (f FilterFunc) Filter(
  12. u *Update,
  13. ) bool {
  14. return f(u)
  15. }