-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lookup the store using store:application instead of application:main
This simplifes the process of registering the store when a user creates a custom one. This change also fixes deprecations warning introduces in Ember 1.12. The store service is now injected as a instanceInitializer.
- Loading branch information
Showing
11 changed files
with
81 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/ember-data/lib/instance-initializers/initialize-store-service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
Configures a registry for use with an Ember-Data | ||
store. | ||
@method initializeStore | ||
@param {Ember.ApplicationInstance} applicationOrRegistry | ||
*/ | ||
export default function initializeStoreService(applicationOrRegistry) { | ||
var registry, container; | ||
if (applicationOrRegistry.registry && applicationOrRegistry.container) { | ||
// initializeStoreService was registered with an | ||
// instanceInitializer. The first argument is the application | ||
// instance. | ||
registry = applicationOrRegistry.registry; | ||
container = applicationOrRegistry.container; | ||
} else { | ||
// initializeStoreService was called by an initializer instead of | ||
// an instanceInitializer. The first argument is a registy. This | ||
// case allows ED to support Ember pre 1.12 | ||
registry = applicationOrRegistry; | ||
container = registry.container(); | ||
} | ||
// Eagerly generate the store so defaultStore is populated. | ||
var store = container.lookup('store:application'); | ||
registry.register('service:store', store, { instantiate: false }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters