# SpatialExternalSurfaceScope

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/subspace/SpatialExternalSurface.kt+class:androidx.xr.compose.subspace.SpatialExternalSurfaceScope) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
sealed interface SpatialExternalSurfaceScope
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/SpatialExternalSurfaceScope` is a scoped environment that provides the `https://developer.android.com/reference/android/view/Surface.html` associated with a `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/SpatialExternalSurface.composable#SpatialExternalSurface(androidx.xr.compose.subspace.StereoMode,androidx.xr.compose.subspace.layout.SubspaceModifier,androidx.xr.compose.subspace.draw.SpatialFeatheringEffect,androidx.xr.compose.subspace.SpatialExternalSurfaceProtection,androidx.xr.compose.subspace.layout.InteractionPolicy,androidx.xr.compose.subspace.SuperSamplingPattern,kotlin.Function1)`

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/SpatialExternalSurfaceScope#onSurfaceCreated(kotlin.Function1)(onSurfaceCreated: (https://developer.android.com/reference/android/view/Surface.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Invoked only one time when the Surface is created. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/SpatialExternalSurfaceScope#onSurfaceDestroyed(kotlin.Function1)(onSurfaceDestroyed: (https://developer.android.com/reference/android/view/Surface.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Invoked when the Composable and its associated `https://developer.android.com/reference/android/view/Surface.html` are destroyed. |

## Public functions

### onSurfaceCreated

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun onSurfaceCreated(onSurfaceCreated: (Surface) -> Unit): Unit
```

Invoked only one time when the Surface is created. This will execute before any layout or modifiers are computed.

### onSurfaceDestroyed

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun onSurfaceDestroyed(onSurfaceDestroyed: (Surface) -> Unit): Unit
```

Invoked when the Composable and its associated `https://developer.android.com/reference/android/view/Surface.html` are destroyed.