Skip to content

EnvironmentFeatures

Capability registry exposed at environment.features.

Set-style membership semantics: unknown names return false so forward-looking scripts can query features that may land in a later runtime version without crashing on today's runtime. Today's queryable strings are 'compute' (GPU compute-kernel dispatch – true on Apple 7+ devices on iOS 18 / visionOS 2 / macOS 15+), 'sharedActivities' (multi-user / SharePlay support – false in App Clip and trait-stripped builds), and 'cameraFeed' (live camera-feed texture – iOS / iPadOS only; not Mac Catalyst, not visionOS). More land here as backends wire up; see the Feature Detection guide for the full per-platform matrix. Use list() for the live set on the current device/runtime.

Methods

has()

javascript
has(name: string): boolean

Whether the named feature is supported on the current platform and runtime version. Unknown names return false (WebGPU Set.has semantic).

Example:

javascript
if (environment.features.has('compute')) {
    mesh.runCompute('advect', { uniforms });
} else {
    stepOnCPU();
}

Parameters:

  • name (string) - Feature identifier; call list() for the set supported on this device/runtime.

Returns: boolean

list()

javascript
list(): string[]

Every feature string currently supported on this device/runtime. Useful for debugging ("why isn't my branch firing?") and for reflecting the capability set into telemetry.

Example:

javascript
console.log(environment.features.list());
// → ['sharedActivities']

Returns: string[]