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

API idea. #28

Open
stefanpenner opened this issue Aug 27, 2015 · 8 comments
Open

API idea. #28

stefanpenner opened this issue Aug 27, 2015 · 8 comments

Comments

@stefanpenner
Copy link
Owner

rather then inject + cp

it would be nice to do.

state: stateFor('email', { key: 'email' })

// or

state: stateFor('email', { key: function(attr, state) { return // w/e you can think of})

in most cases we can likely auto-generate the state service itself, only making the state objects something the user needs to deal with.

cc @thoov

@thoov
Copy link
Collaborator

thoov commented Aug 28, 2015

@stefanpenner I agree with auto-generating the state service or at least doing something behind the scenes so that it is hidden from the users point of view.

How would the user get stateFor in your example if they are not going to inject it?

@stefanpenner
Copy link
Owner Author

How would the user get stateFor in your example if they are not going to inject it?

import

@thoov
Copy link
Collaborator

thoov commented Sep 2, 2015

If you simply import stateFor how would it get access to the container?

I assume you are talking about something like this:

// state-for.js
export default function(stateName, options) {
  // get state from container

  // or simply keep a 'dumb' hashMap here and just reference it instead???

  return state
};

// my-cool-component.js
import Ember from 'ember';
import stateFor from 'path/to/state-for';

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

@stefanpenner
Copy link
Owner Author

@thoov the same way CP's work. (it would just be a type of CP)

@thoov
Copy link
Collaborator

thoov commented Sep 3, 2015

Ok let me whip something up

@stefanpenner
Copy link
Owner Author

👍

@thoov thoov mentioned this issue Sep 3, 2015
@jasonmit
Copy link
Contributor

jasonmit commented Sep 6, 2015

Nice work @thoov. Docs need to be updated to reflect the PR 👍

@thoov
Copy link
Collaborator

thoov commented Sep 6, 2015

@jasonmit ya I am sending another PR with an updated example and I will be updating the readme

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

No branches or pull requests

3 participants