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

New stateFor CP #31

Merged
merged 3 commits into from
Sep 4, 2015
Merged

New stateFor CP #31

merged 3 commits into from
Sep 4, 2015

Conversation

thoov
Copy link
Collaborator

@thoov thoov commented Sep 3, 2015

Solves: #28

This gives the following syntax:

import Ember from 'ember';
import stateFor from 'ember-state-services/stateFor';

export default Ember.Component.extend({
  data: stateFor('state-name', { key: 'state-key' })
});

@stefanpenner I need to talk with you about how we should handle "default" state. Before this was done inside of the users own service file (inside setupState override) but now this is done behind the scenes.

@stefanpenner
Copy link
Owner

@stefanpenner I need to talk with you about how we should handle "default" state. Before this was done inside of the users own service file (inside setupState override) but now this is done behind the scenes.

i wonder if we should allow for a callback to be provided straight to this CP to be a "factory" or builder

if we need to reuse it maybe it should be a static method on the state object.

var MyState = Ember.Object.extend(...);

MyState.reopenClass({
  setupState(key, container) {
    return this.create(...)
  }
})

or is es6

class MyState extends Ember.Object {
  static setupState(...)  {...}
}

@thoov
Copy link
Collaborator Author

thoov commented Sep 3, 2015

@stefanpenner Ok take a look now. I added this:

BufferedProxy.reopenClass({
  initialState() {
    return { content: this.get('email') };
  }
});

@stefanpenner
Copy link
Owner

LGTM

@thoov
Copy link
Collaborator Author

thoov commented Sep 4, 2015

I'm going to merge this so I can use it with my new example PR that I will be sending later today

thoov added a commit that referenced this pull request Sep 4, 2015
@thoov thoov merged commit 24f5e9b into stefanpenner:master Sep 4, 2015
@thoov thoov deleted the stateForCP branch September 4, 2015 19:40
@stefanpenner
Copy link
Owner

@thoov hey, got time to update the readme?

@thoov
Copy link
Collaborator Author

thoov commented Sep 5, 2015

Yes I will update it with my next PR

@stefanpenner
Copy link
Owner

@thoov awesome thanks!

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.

2 participants