Skip to content

Instantly share code, notes, and snippets.

@foxnewsnetwork
Created January 22, 2015 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxnewsnetwork/51cb80a64c690c8eaec8 to your computer and use it in GitHub Desktop.
Save foxnewsnetwork/51cb80a64c690c8eaec8 to your computer and use it in GitHub Desktop.
Emberjs initializer to get the store in your components
initialize = (ctn, app) ->
app.inject "component", "store", "store:main"
ComponentStoreInitializer =
name: 'component-store'
initialize: initialize
# Then, wherever you're creating your app, do the following:
Ember.Application.initializer ComponentStoreInitializer
@foxnewsnetwork
Copy link
Author

This initializer allows you to access this.store in your components, handy as some components need semi-static resources that should be fetched once and only once from the server somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment