mardi 14 février 2017

EmberJs; conditionally start instance initializer

Is it possible to conditionally run an instance initializer based on an environment variable?

The use case: I have an Ember app running on my local machine. If a certain environment variable is present when the app starts, I want to start a service called "lights". If it's not present I do not want the service to run.

//instance-intializers/lights.js
 export default {
  name: 'lights',
  initialize(application) {
  application.container.lookup('service:lights');
 }
};




Aucun commentaire:

Enregistrer un commentaire