jeudi 16 mars 2017

Ember JS automatically register directory classes to DI

Creating in-repo-addon in Ember.JS gives a lot of possibilities. Today I've stumbled into a case when I wanted to register all classes in directory (for example my-dir) into Dependency Injector (same way it's done with services by Ember, but I wanted to use some other namespace).

For example I want to allow developer to create multiple classes inside proxy directory, and register all of them in DI under proxy: namespace. So later we can use:

Ember.Component.extend({
  myProxy: Ember.inject('proxy:my'),
});




Aucun commentaire:

Enregistrer un commentaire