code: func NewEventSystem(mux *event.TypeMux, backend Backend, lightMode bool) *EventSystem {
  	m := &EventSystem{
  		mux:       mux,
  		backend:   backend,
  		lightMode: lightMode,
  		install:   make(chan *subscription),
  		uninstall: make(chan *subscription),
  		txsCh:     make(chan core.NewTxsEvent, txChanSize),
  		logsCh:    make(chan []*types.Log, logsChanSize),
  		rmLogsCh:  make(chan core.RemovedLogsEvent, rmLogsChanSize),
  		chainCh:   make(chan core.ChainEvent, chainEvChanSize),
  	}
  
  	// Subscribe events
  	m.txsSub = m.backend.SubscribeNewTxsEvent(m.txsCh)
  	m.logsSub = m.backend.SubscribeLogsEvent(m.logsCh)
  	m.rmLogsSub = m.backend.SubscribeRemovedLogsEvent(m.rmLogsCh)
  	m.chainSub = m.backend.SubscribeChainEvent(m.chainCh)
  	// TODO(rjl493456442): use feed to subscribe pending log event
  	m.pendingLogSub = m.mux.Subscribe(core.PendingLogsEvent{})
  
  	// Make sure none of the subscriptions are empty
  	if m.txsSub == nil || m.logsSub == nil || m.rmLogsSub == nil || m.chainSub == nil ||
  		m.pendingLogSub.Closed() {
  		log.Crit("Subscribe for event system failed")
  	}
  
  	go m.eventLoop()
  	return m
  }
docs: // NewEventSystem creates a new manager that listens for event on the given mux,
  // parses and filters them. It uses the all map to retrieve filter changes. The
  // work loop holds its own index that is used to forward events to filters.
  //
  // The returned manager has a loop that needs to be stopped with the Stop function
  // or by stopping the given mux.