# DocumentEnd

Why a Document ended, as [`onDocumentEnd(_:)`](<https://rasmuskard.github.io/react-native-minimal-webview/swift/documentation/minimalwebview/webviewcontext/ondocumentend(_-)/index.md>) and [`onDestroyed(_:)`](<https://rasmuskard.github.io/react-native-minimal-webview/swift/documentation/minimalwebview/webviewcontext/ondestroyed(_-)/index.md>) report it.

```swift
enum DocumentEnd
```

## Overview

A Document is the main-frame page on screen: from a navigation’s commit to the next commit, a renderer crash or the view closing.

The first commit after the view is made, or after a crash, opens one and ends nothing.

A Document doesn’t end at a same-document navigation (`pushState`, `replaceState`, a hash change), an iframe’s navigation, a load that never commits (a stop, a download, a 204, a failure), the view leaving the window or the app going to the background.
