---
title: "requestDocumentContext(_:completionHandler:)"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/betextinput/requestdocumentcontext(_:completionhandler:)"
---

# requestDocumentContext(_:completionHandler:)

Gathers context for the system about the current document.

## Declaration

```swift
func requestDocumentContext(_ request: BETextDocumentRequest, completionHandler: @escaping @Sendable (BETextDocumentContext) -> Void)
```

```swift
func requestDocumentContext(_ request: BETextDocumentRequest) async -> BETextDocumentContext
```

## See Also

### Requesting context

- [requestTextContextForAutocorrection(completionHandler:)](browserenginekit/betextinput/requesttextcontextforautocorrection(completionhandler:).md)
- [requestTextRects(for:withCompletionHandler:)](browserenginekit/betextinput/requesttextrects(for:withcompletionhandler:).md)
