safePop method

void safePop()

Implementation

void safePop() {
// If there is only one route on the stack, navigate to the initial
// page instead of popping.
  if (canPop()) {
    pop();
  } else {
    go('/');
  }
}