Skip to content

Commit

Permalink
Merge pull request #2 from silvertern/master
Browse files Browse the repository at this point in the history
Start to returns the spinner to compress new & start & defer stop in one line…
  • Loading branch information
caarlos0 authored May 2, 2017
2 parents 389dc5a + beda41f commit ac25467
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spin.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func (s *Spinner) Set(frames string) {
}

// Start shows the spinner.
func (s *Spinner) Start() {
func (s *Spinner) Start() *Spinner {
if atomic.LoadUint64(&s.active) > 0 {
return
return s
}
atomic.StoreUint64(&s.active, 1)
go func() {
Expand All @@ -66,6 +66,7 @@ func (s *Spinner) Start() {
time.Sleep(100 * time.Millisecond)
}
}()
return s
}

// Stop hides the spinner.
Expand Down

0 comments on commit ac25467

Please sign in to comment.