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

Access current state #7

Closed
pauldijou opened this issue Nov 3, 2013 · 3 comments
Closed

Access current state #7

pauldijou opened this issue Nov 3, 2013 · 3 comments

Comments

@pauldijou
Copy link
Contributor

Hey,

Is there a way to access the current state from JS and all its "configuration"? Something like "Router.currentState()" returning a useful object, something like:

{
  name: String: the name off the current state
  fullName: String: the concatenation of the current name with all ancestor names separated by a "."
  parent: Object: the same object but for its parent if one
  params: Hash: all dynamic params in the url
  query: Hash: all the query string
  ... all the components or the url ...
}

For exploding the url to several components, you could use URI.js (see how they decompose an url here : http://medialize.github.io/URI.js/about-uris.html ). The benefit would be to abstract modern browsers using History API to old browsers using an hashbang or whatever in a common API inside your router.

@sompylasar
Copy link

I had a need for this several times in my project, too, but every time I avoided adding it into my fork (I just had flags set when entering a state - a dirty hack). That would be a good addition for Abyssa.

@AlexGalays
Copy link
Owner

yes, sounds good guys!

@AlexGalays
Copy link
Owner

This should be addressed by this commit: 2a693b5

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