

RouteMap, a new open source client/server-side JavaScript URL Mapping Library - KirkWylie
https://github.com/OpenGamma/RouteMap

======
luigi
One thing to make clear: simply using #! does not make your app crawlable.
Your server-side app needs to also handle URLs that contain
_escaped_fragment_, per Google's specification:

[http://code.google.com/web/ajaxcrawling/docs/getting-
started...](http://code.google.com/web/ajaxcrawling/docs/getting-started.html)

~~~
afshin
Yes, thanks for pointing that out. This is only one side of the coin. The
other side is a server that will answer all of those requests.

------
vmind
Would it be possible to use pushState as the main mechanism on the client, and
use a #! as a fallback? You would end up with two different possible URLs, but
if the same library handles the calls then it would be fairly straightforward
to move from one to the other.

~~~
afshin
Yes, this is possible.

If you do capability detection by checking to see if window.history.pushState
exists, then you can configure RouteMap.handler to be tied to history events.
Otherwise, you can set the prefix by calling RouteMap.prefix('!').

EDIT: I re-read your question, and I think that I misunderstood. I do think
what you're asking is possible, and what I stated above is a piece of what
you'd need to do. Basically, instead of simply binding RouteMap.handler to
either onhashchange or onpopstate, you'd probably have to write an event
listener for both of those methods + a window onload handler all of which send
their respective portions of the URL that you care about to RouteMap.handler.

------
rbranson
Not to be overly pedantic, but a piece of core functionality like this seems
like it would really need some basic automated tests, even if they were just
running the API through it's paces.

The thorough documentation is awesome though!

~~~
afshin
Thanks for the suggestion. We haven't actually decided on the larger project's
testing scheme, but once we do, we'll definitely be adding tests to RouteMap
as well.

