title: How best to handle large external API so that a single instance can be shared among multiple components?
body: <p>I want to create a single instance of an object with a <a href="http://www.rtcmulticonnection.org/docs/" rel="nofollow">large external API</a>, and share it among several components of my app. </p>
  
  <p>This API has several event methods (e.g. <code>onJoin()</code>, <code>onClose()</code>, <code>onOpen()</code>, etc.) which I need to implement. As different events are associated with different components of my app, I was thinking of implementing these events within those components, rather than all within a Singleton class. </p>
  
  <p>Alternatively, I was wondering if I should--or even could--have each of these event methods trigger a custom event created with <code>EventEmitter</code>, and have listener methods in each of the relevant component classes ready to handle these events. But it appears that <code>EventEmitter</code> <a href="https://angular.io/docs/ts/latest/api/core/index/EventEmitter-class.html" rel="nofollow">can only be used by components and directives</a>, not plain classes.</p>
  
  <p>Another concern is whether I should create a Singleton class for this object or treat it as a kind of 'Service' and inject it into the dependent components.</p>
  
  <p>Any help is much appreciated!</p>
  
  <p>Thanks</p>