millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Best way to detect param changes in the same route #147

Open oskarrough opened 8 years ago

oskarrough commented 8 years ago

Assuming the following route:

crossroads.addRoute('/chapters/{id}', id => {
  console.log(id);
});

What is the right way to detect a change from /chapters/1 to /chapters/2? The match method is called but I can't seem to access the previous param.

More specifically, I'm looking for a way to trigger a custom exit method with the id param as argument.