22 lines
355 B
Go
22 lines
355 B
Go
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
|
|
}
|