refactoring renderDelay to dealyRC
Vladimir Bauer
3 years ago
| 50 | 50 |
// rendering will start as soon as provided chan is closed.
|
| 51 | 51 |
func WithRenderDelay(ch <-chan struct{}) ContainerOption {
|
| 52 | 52 |
return func(s *pState) {
|
| 53 | |
s.renderDelay = ch
|
|
53 |
s.delayRC = ch
|
| 54 | 54 |
}
|
| 55 | 55 |
}
|
| 56 | 56 |
|
| 44 | 44 |
reqWidth int
|
| 45 | 45 |
popCompleted bool
|
| 46 | 46 |
autoRefresh bool
|
| 47 | |
renderDelay <-chan struct{}
|
|
47 |
delayRC <-chan struct{}
|
| 48 | 48 |
manualRC <-chan interface{}
|
| 49 | 49 |
shutdownNotifier chan<- interface{}
|
| 50 | 50 |
queueBars map[*Bar]*Bar
|
|
| 273 | 273 |
}
|
| 274 | 274 |
|
| 275 | 275 |
func (s pState) autoRefreshListener(done chan struct{}) {
|
| 276 | |
if s.renderDelay != nil {
|
| 277 | |
<-s.renderDelay
|
|
276 |
if s.delayRC != nil {
|
|
277 |
<-s.delayRC
|
| 278 | 278 |
}
|
| 279 | 279 |
ticker := time.NewTicker(s.refreshRate)
|
| 280 | 280 |
defer ticker.Stop()
|