Add `onBeforeExit` similar to `window.onbeforeunload`

Example:

```javascript
{
  ...
  onBeforeUnload: ['$window', 'dirty', function($window, dirty) {
    if (dirty.isSessionDirty()) return $window.confirm("Are you sure you would like to navigate?"));
    else return true;
  }
  ...
}
```