Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Ember.get() to access store #62

Merged
merged 1 commit into from
Aug 1, 2015

Conversation

mike-north
Copy link
Collaborator

I'm playing with a few interesting use cases, which involve using the "route.js" mixin on objects other than a route (i.e., an Ember.Service or something).

Allowing the store to be accessed is not a big problem -- I can just add a CP on this object

  store: computed({
    get() {
      return this.container.lookup('store:main');
    }
  }),

Unfortunately, accessing this CP directly via a this.store, before the CP's getter function has been invoked for the first time, will end up returning the computed property its self, rather than the property's value.

This small change should maintain the existing use cases just fine, and also allow for potential usage that deviates from the well-traveled path.

@hhff
Copy link
Collaborator

hhff commented Jul 31, 2015

Looks good mike! If you can green it off I'm happy to merge! I've also been scheming on the concept of of allowing the developer to describe a "promise generator" rather than relying on the ember data store, for folks who aren't using it.

Glad u found this use case before I started on that work...!

@mike-north mike-north changed the title USe this.get() to access store UsSe this.get() to access store Jul 31, 2015
@mike-north mike-north changed the title UsSe this.get() to access store Use this.get() to access store Jul 31, 2015
@mike-north mike-north changed the title Use this.get() to access store Use Ember.get() to access store Jul 31, 2015
@mike-north
Copy link
Collaborator Author

@hhff ping

@kellyselden
Copy link
Collaborator

@mike-north

  store: computed({
    get() {
      return this.container.lookup('store:main');
    }
  }),

couldn't this work?

  store: Ember.inject.service(),

@hhff
Copy link
Collaborator

hhff commented Aug 1, 2015

👍 Pretty sure inject doesn't work with the store @kellyselden

hhff added a commit that referenced this pull request Aug 1, 2015
Use Ember.get() to access store
@hhff hhff merged commit da7862a into adopted-ember-addons:master Aug 1, 2015
@hhff
Copy link
Collaborator

hhff commented Aug 1, 2015

released 0.0.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants