Switch Ember initializers to public API methods

This commit is contained in:
Jason Williams 2014-06-23 18:35:39 +00:00
parent d135930344
commit ee7c274ba7
4 changed files with 17 additions and 17 deletions

View File

@ -1,12 +1,12 @@
var CSRFTokenInitializer = {
name: 'csrf-token',
initialize: function (container) {
container.register('csrf:token', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
initialize: function (container, application) {
application.register('csrf:token', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
container.injection('route', 'csrf', 'csrf:token');
container.injection('model', 'csrf', 'csrf:token');
container.injection('controller', 'csrf', 'csrf:token');
application.inject('route', 'csrf', 'csrf:token');
application.inject('model', 'csrf', 'csrf:token');
application.inject('controller', 'csrf', 'csrf:token');
}
};

View File

@ -1,11 +1,11 @@
var CSRFInitializer = {
name: 'csrf',
initialize: function (container) {
container.register('csrf:current', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
initialize: function (container, application) {
application.register('csrf:current', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
container.injection('route', 'csrf', 'csrf:current');
container.injection('controller', 'csrf', 'csrf:current');
application.inject('route', 'csrf', 'csrf:current');
application.inject('controller', 'csrf', 'csrf:current');
}
};

View File

@ -22,11 +22,11 @@ var currentUserInitializer = {
// Find the user (which should be fast since we just preloaded it in the store)
store.find('user', preloadedUser.id).then(function (user) {
// Register the value for injection
container.register('user:current', user, { instantiate: false });
application.register('user:current', user, { instantiate: false });
// Inject into the routes and controllers as the user property.
container.injection('route', 'user', 'user:current');
container.injection('controller', 'user', 'user:current');
application.inject('route', 'user', 'user:current');
application.inject('controller', 'user', 'user:current');
application.advanceReadiness();
});

View File

@ -4,12 +4,12 @@ var ghostPathsInitializer = {
name: 'ghost-paths',
after: 'store',
initialize: function (container) {
container.register('ghost:paths', ghostPaths(), {instantiate: false});
initialize: function (container, application) {
application.register('ghost:paths', ghostPaths(), { instantiate: false });
container.injection('route', 'ghostPaths', 'ghost:paths');
container.injection('model', 'ghostPaths', 'ghost:paths');
container.injection('controller', 'ghostPaths', 'ghost:paths');
application.inject('route', 'ghostPaths', 'ghost:paths');
application.inject('model', 'ghostPaths', 'ghost:paths');
application.inject('controller', 'ghostPaths', 'ghost:paths');
}
};