RegistryProxyMixin#registerOptionsForType()

registerOptionsForType (type, options) public

Defined in packages/ember-runtime/lib/mixins/registry_proxy.js:162

Allow registering options for all factories of a type.

let App = Ember.Application.create();
let appInstance = App.buildInstance();

// if all of type `connection` must not be singletons
appInstance.optionsForType('connection', { singleton: false });

appInstance.register('connection:twitter', TwitterConnection);
appInstance.register('connection:facebook', FacebookConnection);

let twitter = appInstance.lookup('connection:twitter');
let twitter2 = appInstance.lookup('connection:twitter');

twitter === twitter2; // => false

let facebook = appInstance.lookup('connection:facebook');
let facebook2 = appInstance.lookup('connection:facebook');

facebook === facebook2; // => false

Parameters:

type String
options Object
doc_EmberJs
2016-11-30 16:53:01
Comments
Leave a Comment

Please login to continue.