Skip to content

Instantly share code, notes, and snippets.

@ctrlShiftBryan
Created January 2, 2015 21:21
Show Gist options
  • Select an option

  • Save ctrlShiftBryan/7849d03137a8bdb20ccd to your computer and use it in GitHub Desktop.

Select an option

Save ctrlShiftBryan/7849d03137a8bdb20ccd to your computer and use it in GitHub Desktop.
Cancel a route and reload in sammy
sam.before({}, function () {
var cancel = false;
if (vm.LastLocation) {
cancel = vm.LastLocation !== window.location.pathname;
}
vm.LastLocation = window.location.pathname;
if (cancel) {
window.location.reload();
}
return !cancel;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment