code: func (api *PublicDownloaderAPI) eventLoop() {
  	var (
  		sub               = api.mux.Subscribe(StartEvent{}, DoneEvent{}, FailedEvent{})
  		syncSubscriptions = make(map[chan interface{}]struct{})
  	)
  
  	for {
  		select {
  		case i := <-api.installSyncSubscription:
  			syncSubscriptions[i] = struct{}{}
  		case u := <-api.uninstallSyncSubscription:
  			delete(syncSubscriptions, u.c)
  			close(u.uninstalled)
  		case event := <-sub.Chan():
  			if event == nil {
  				return
  			}
  
  			var notification interface{}
  			switch event.Data.(type) {
  			case StartEvent:
  				notification = &SyncingResult{
  					Syncing: true,
  					Status:  api.d.Progress(),
  				}
  			case DoneEvent, FailedEvent:
  				notification = false
  			}
  			// broadcast
  			for c := range syncSubscriptions {
  				c <- notification
  			}
  		}
  	}
  }
docs: // eventLoop runs a loop until the event mux closes. It will install and uninstall new
  // sync subscriptions and broadcasts sync status updates to the installed sync subscriptions.