tui/tmpl_modal.go

22 lines
355 B
Go
Raw Normal View History

2023-04-24 11:41:38 +02:00
package tui
type ModalTmpl[T any] struct {
WrapperTmpl
resultCh chan T
screen *Screen
}
var _ Modal[int] = &ModalTmpl[int]{}
func (m *ModalTmpl[T]) Open(s *Screen) <-chan T {
m.resultCh = make(chan T)
m.screen = s
return m.resultCh
}
func (m *ModalTmpl[T]) Close(result T) {
m.resultCh <- result
m.screen.CloseModal() // TODO which modal
}