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

Support for sub state managers on router #1126

Closed
tchak opened this issue Jul 7, 2012 · 6 comments
Closed

Support for sub state managers on router #1126

tchak opened this issue Jul 7, 2012 · 6 comments

Comments

@tchak
Copy link
Member

tchak commented Jul 7, 2012

What I am doing right now is this :

Ember.onLoad('application', function(app) {
  app.registerInjection({
    name: 'stateManagers',
    after: 'controllers',
    injection:  function(app, router, property) {
      if (!/^[A-Z].*StateManager$/.test(property)) { return; }

      var name = property[0].toLowerCase() + property.substr(1),
          stateManager = app[property].create();

      stateManager.set('router', router);
      router.set(name, stateManager);
      Ember.keys(router).forEach(function(key) {
        if (/^[a-z].*Controller$/.test(key)) {
          stateManager.set(key, router.get(key));
        }
      });
    }
  })
});

And I modified transitionTo to accept as first argument the name of state manager you want to run transition on.
I am planing to do more work to make the experience as transparent as possible

Would there be interest in adopting something like this in core?

@ghempton
Copy link
Member

ghempton commented Aug 4, 2012

I think we need a more generic injection mechanism that would support injecting anything (e.g. currentUser, state managers, etc.). Seems like we also need a way to signal classes that shouldn't be injected.

@wagenet
Copy link
Member

wagenet commented Oct 19, 2012

@tchak What's the current thought on this?

@tchak
Copy link
Member Author

tchak commented Oct 19, 2012

I am currently using a sort of "triage" in the send on the router. It can rerout some events on sub event managers.
I can write a proposal for this, if there enough interest.

@wagenet
Copy link
Member

wagenet commented Oct 20, 2012

@tchak I feel like it's something that definitely would be useful, though we'd want to think carefully about how to do it without confusing users.

@wagenet
Copy link
Member

wagenet commented Dec 19, 2012

@tchak How does this play in with the new router?

@wagenet
Copy link
Member

wagenet commented Jan 1, 2013

This isn't directly applicable to the new router.

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