> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperwisor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# context

> Product, device, user, and environment info available to a script.

The `context` global describes who and what the script is running for.

## Shape

```js theme={null}
context.productId   // string | null
context.deviceId    // string | null
context.user        // { id, email, role } | null
context.device      // environment info (see below)
```

## Environment info — `context.device`

Describes the viewing device (the browser/screen the dashboard is shown on):

```js theme={null}
context.device.type          // 'mobile' | 'tablet' | 'desktop'
context.device.isMobile      // boolean
context.device.isTablet      // boolean
context.device.isDesktop     // boolean
context.device.screenWidth   // number
context.device.screenHeight  // number
context.device.orientation   // 'portrait' | 'landscape'
context.device.touchEnabled  // boolean
```

## Example — responsive behavior

```js theme={null}
if (context.device.isMobile) {
  widget.hide('sidebarChart');
}

if (context.user?.role === 'admin') {
  widget.show('adminControls');
}
```

<Card title="Next: Events" icon="bolt" href="/script/events">
  The full widget event vocabulary.
</Card>
