Skip to content

Commit

Permalink
Auto merge of #145 - poteto:hotfix-initializer, r=poteto
Browse files Browse the repository at this point in the history
Hotfix for consuming apps with no defaults defined

None
  • Loading branch information
homu committed Feb 18, 2016
2 parents 0d45a61 + b4be627 commit 45b89f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/initializers/flash-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ const addonDefaults = {

export function initialize() {
const application = arguments[1] || arguments[0];
const { flashMessageDefaults } = config;
const { injectionFactories } = flashMessageDefaults;
const { flashMessageDefaults } = config || {};
const { injectionFactories } = flashMessageDefaults || [];
const options = merge(addonDefaults, flashMessageDefaults);
const shouldShowDeprecation = !(injectionFactories && injectionFactories.length);

application.register('config:flash-messages', options, { instantiate: false });
application.inject('service:flash-messages', 'flashMessageDefaults', 'config:flash-messages');

deprecate(INJECTION_FACTORIES_DEPRECATION_MESSAGE, shouldShowDeprecation, {
id: 'ember-cli-flash.deprecate-injection-factories'
id: 'ember-cli-flash.deprecate-injection-factories',
until: '2.0.0'
});

options.injectionFactories.forEach((factory) => {
Expand Down

0 comments on commit 45b89f8

Please sign in to comment.