Skip to content

Commit

Permalink
Update README.md: specify scope usage
Browse files Browse the repository at this point in the history
  • Loading branch information
PatilShreyas committed Apr 21, 2024
1 parent d777ac6 commit 4e2adc2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ To capture the content, use [`CaptureController#captureAsync()`](https://patilsh

```kotlin
// Example: Capture the content when button is clicked
val scope = rememberCoroutineScope()
Button(onClick = {
// Capture content
val bitmapAsync = captureController.captureAsync()
try {
val bitmap = bitmapAsync.await()
// Do something with `bitmap`.
} catch (error: Throwable) {
// Error occurred, do something.
scope.launch {
val bitmapAsync = captureController.captureAsync()
try {
val bitmap = bitmapAsync.await()
// Do something with `bitmap`.
} catch (error: Throwable) {
// Error occurred, do something.
}
}
}) { ... }
```
Expand Down

0 comments on commit 4e2adc2

Please sign in to comment.