tomasbasham / ember-cli-analytics

An ember-cli addon to interface with analytics services and external integrations
MIT License
8 stars 9 forks source link

service:analytics#config is blank, making the class hard to extend #15

Open jamesarosen opened 6 years ago

jamesarosen commented 6 years ago

https://github.com/tomasbasham/ember-cli-analytics/blob/f891eac9f85f0a932d60f9754f7b83ed103d43db/addon/services/analytics.js#L77

service:analytics#createAdapters looks for config.analytics.integrations, but there's no config computed property on service:analytics. This library gets around that by defining config in app/services/analytics.

I can't extend this library's version of app/services/analytics; I can only import the addon version from ember-cli-analytics/services/analytics. That means I lose the config definition and have to supply it myself. That's not hard to do, but it's not obvious that I need to. (I spent a good 45 minutes trying to debug why my list of integrations was empty.)

Instead, I recommend

// addon/services/analytics.js

config: computed(function() {
  return getOwner(this).resolveRegistration('config:environment')
})
tomasbasham commented 5 years ago

Thank you for suggesting this. I've gone ahead and implemented this change. It is only on master currently whilst I try and sort out the other issue you posted