How to inject a service in discourse?

I had thought that is what evented was meant for, but I haven’t used it before. The goal is just to get an ipc-like setup where

  • user clicks button in component A
  • that click causes data to load in component B

I’m more familiar with Angular, where creating then subscribing to a service would be the general way to do it. But in Discourse the best way is appEvents?