---
# System prepended metadata

title: '`NavigateResult` interface'
tags: [brew-js]

---

---
tags: brew-js
---

# `NavigateResult` interface

The `NavigateResult` interface contains the outcome of `app.navigate` if navigation is completed.

```typescript
function onClick() {
    app.navigate('/foo').then(result => { /* ... */ })
}
```

## Properties

### `NavigateResult.id`

A unique ID that can identify page load caused by navigation.

```typescript
readonly id: string;
```

:::info
This is the same unique ID that is set to `history.state`.
:::

### `NavigateResult.path`

Gets the path being navigated to.

```typescript
readonly path: string;
```

If redirection has occured, redirected path will be returned.

```typescript
app.on('navigate', e => {
   if (e.newPathname === '/foo') {
       return app.navigate('/bar', true);
   }
});

const { path } = await app.navigate('/foo');
assert(path === '/bar');
```

### `NavigateResult.navigated`

Gets if navigation event has actually fired as caused a page load

```typescript
readonly navigated: boolean;
```

### `NavigateResult.redirected`

Gets if the app landed on current path through redirection.

```typescript
readonly redirected: boolean;
```

### `NavigateResult.originalPath`

Gets the original path that is passed to `app.navigate` if it has been redirected.

```typescript
readonly originalPath: string | null;
```