()
| 49 | } |
| 50 | |
| 51 | func (s *Spinner) String() string { |
| 52 | if s.stop { |
| 53 | return s.done |
| 54 | } |
| 55 | |
| 56 | d := time.Since(s.time) |
| 57 | if d.Milliseconds() > 100 { |
| 58 | s.index = (s.index + 1) % len(s.chars) |
| 59 | } |
| 60 | |
| 61 | return s.chars[s.index] |
| 62 | } |
| 63 | |
| 64 | func (s *Spinner) Stop() { |
| 65 | s.stop = true |
no outgoing calls