AlexGalays/abyssa-js

Access current state

Closed this issue · 3 comments

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.

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.

yes, sounds good guys!

This should be addressed by this commit: 2a693b5