ShowLoading displays an animated loading indicator.
(message string)
| 58 | |
| 59 | // ShowLoading displays an animated loading indicator. |
| 60 | func (h *Header) ShowLoading(message string) { |
| 61 | h.mu.Lock() |
| 62 | if h.isLoading && h.loadingText == message { |
| 63 | h.mu.Unlock() |
| 64 | return |
| 65 | } |
| 66 | |
| 67 | if h.isLoading && h.loadingCancel != nil { |
| 68 | h.loadingCancel() |
| 69 | } |
| 70 | |
| 71 | h.isLoading = true |
| 72 | h.loadingText = message |
| 73 | ctx, cancel := context.WithCancel(context.Background()) |
| 74 | h.loadingCancel = cancel |
| 75 | h.mu.Unlock() |
| 76 | |
| 77 | go h.animateLoading(ctx) |
| 78 | } |
| 79 | |
| 80 | // StopLoading stops the loading animation. |
| 81 | func (h *Header) StopLoading() { |
nothing calls this directly
no test coverage detected