recursal/MDN huggingface dataset:
AudioListener: forwardX property
================================

The `forwardX` read-only property of the `AudioListener` interface is an `AudioParam` representing the x value of the direction vector defining the forward direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `panningModel` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-forwardx |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: upZ property
===========================

The `upZ` read-only property of the `AudioListener` interface is an `AudioParam` representing the z value of the direction vector defining the up direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `PannerNode` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-upz |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: setOrientation() method
======================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The `setOrientation()` method of the `AudioListener` interface defines the orientation of the listener.

It consists of two direction vectors:

* The *front vector*, defined by the three unitless parameters `x`, `y` and `z`, describes the direction of the face of the listener, that is the direction the nose of the person is pointing towards. The front vector's default value is `(0, 0, -1)`.
* The *up vector*, defined by three unitless parameters `xUp`, `yUp` and `zUp`, describes the direction of the top of the listener's head. The up vector's default value is `(0, 1, 0)`.

The two vectors must be separated by an angle of 90° — in linear analysis terms, they must be perpendicular to each other.

Syntax
------


```js
setOrientation(x, y, z, xUp, yUp, zUp)
```

### Parameters

`x`

The x value of the front vector of the listener.

`y`

The y value of the front vector of the listener.

`z`

The z value of the front vector of the listener.

`xUp`

The x value of the up vector of the listener.

`yUp`

The y value of the up vector of the listener.

`zUp`

The z value of the up vector of the listener.

### Return value

None (`undefined`).

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-setorientation |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: setPosition() method
===================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The `setPosition()` method of the `AudioListener` Interface defines the position of the listener.

The three parameters `x`, `y` and `z` are unitless and describe the listener's position in 3D space according to the right-hand Cartesian coordinate system. `PannerNode` objects use this position relative to individual audio sources for spatialization.

The default value of the position vector is `(0, 0, 0)`.

**Note:** As this method is deprecated, use the three `positionX`, `positionY`, and `positionZ` properties instead.

Syntax
------


```js
setPosition(x, y, z)
```

### Parameters

`x`

The x position of the listener in 3D space.

`y`

The y position of the listener in 3D space.

`z`

The z position of the listener in 3D space.

### Return value

None (`undefined`).

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-setposition |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: positionY property
=================================

The `positionY` read-only property of the `AudioListener` interface is an `AudioParam` representing the y position of the listener in 3D cartesian space.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `PannerNode` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-positiony |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: forwardY property
================================

The `forwardY` read-only property of the `AudioListener` interface is an `AudioParam` representing the y value of the direction vector defining the forward direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `panningModel` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

See BaseAudioContext.createPanner() for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-forwardy |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: upY property
===========================

The `upY` read-only property of the `AudioListener` interface is an `AudioParam` representing the y value of the direction vector defining the up direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `PannerNode` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 1, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-upy |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: forwardZ property
================================

The `forwardZ` read-only property of the `AudioListener` interface is an `AudioParam` representing the z value of the direction vector defining the forward direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `panningModel` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is -1, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-forwardz |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: positionZ property
=================================

The `positionZ` read-only property of the `AudioListener` interface is an `AudioParam` representing the z position of the listener in 3D cartesian space.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `PannerNode` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

See `BaseAudioContext.createPanner()` for example code.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-positionz |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
AudioListener: upX property
===========================

The `upX` read-only property of the `AudioListener` interface is an `AudioParam` representing the x value of the direction vector defining the up direction the listener is pointing in.

**Note:** The parameter is *a-rate* when used with a `PannerNode` whose `PannerNode` is set to equalpower, or *k-rate* otherwise.

Value
-----

An `AudioParam`. Its default value is 0, and it can range between positive and negative infinity.

Examples
--------

For more detailed example code see `BaseAudioContext.createPanner()`.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-audiolistener-upx |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
TrustedHTML: toJSON() method
============================

The **`toJSON()`** method of the `TrustedHTML` interface returns a JSON representation of the stored data.

Syntax
------


```js
toJSON()
```

### Parameters

None.

### Return value

A string containing a JSON representation of the stored data.

Examples
--------

The constant `escaped` is an object created via the Trusted Types policy escapeHTMLPolicy. The `toString()` method returns a string to safely insert into a document.


```js
const escapeHTMLPolicy = trustedTypes.createPolicy("myEscapePolicy", {
  createHTML: (string) => string.replace(/>/g, "<"),
});

const escaped = escapeHTMLPolicy.createHTML("<img src=x onerror=alert(1)>");
console.log(escaped.toJSON());
```

Specifications
--------------

| Specification |
| --- |
| Trusted Types # dom-trustedhtml-tojson |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
TrustedHTML: toString() method
==============================

The **`toString()`** method of the `TrustedHTML` interface returns a string which may safely inserted into an injection sink.

Syntax
------


```js
toString()
```

### Parameters

None.

### Return value

A string containing the sanitized HTML.

Examples
--------

The constant `escaped` is an object created via the Trusted Types policy escapeHTMLPolicy. The `toString()` method returns a string to safely insert into a document.


```js
const escapeHTMLPolicy = trustedTypes.createPolicy("myEscapePolicy", {
  createHTML: (string) => string.replace(/>/g, "<"),
});

const escaped = escapeHTMLPolicy.createHTML("<img src=x onerror=alert(1)>");
console.log(escaped.toString());
```

Specifications
--------------

| Specification |
| --- |
| Trusted Types # trustedhtml-stringification-behavior |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
CSSUnitValue: CSSUnitValue() constructor
========================================

 The **`CSSUnitValue()`** constructor creates a
 new `CSSUnitValue` object which returns a new `CSSUnitValue`
 object which represents values that contain a single unit type. For example, "42px"
 would be represented by a `CSSNumericValue`.

Syntax
------


```js
new CSSUnitValue()
```

### Parameters

`value`

Returns a double indicating the number of units.

`unit`

Returns a string indicating the type of unit.

Examples
--------

 The following shows a method of creating a `CSSPositionValue` from
 individual `CSSUnitValue` constructors.


```js
let pos = new CSSPositionValue(
  new CSSUnitValue(5, "px"),
  new CSSUnitValue(10, "px"),
);
```

Specifications
--------------

| Specification |
| --- |
| CSS Typed OM Level 1 # dom-cssunitvalue-cssunitvalue |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `CSSUnitValue.unit`
* `CSSUnitValue.value`
* Using the CSS Typed OM
* CSS Typed Object Model API
CSSUnitValue: value property
============================

 The **`CSSUnitValue.value`** property of the
 `CSSUnitValue` interface returns a double indicating the number of units.

Value
-----

A double.

Examples
--------

 The following creates a `CSSPositionValue` from individual
 `CSSUnitValue` constructors, then queries the
 `CSSUnitValue.value`.


```js
const pos = new CSSPositionValue(
  new CSSUnitValue(5, "px"),
  new CSSUnitValue(10, "px"),
);

console.log(pos.x.value); // 5
console.log(pos.y.value); // 10
```

Specifications
--------------

| Specification |
| --- |
| CSS Typed OM Level 1 # dom-cssunitvalue-value |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `CSSUnitValue.unit`
* Using the CSS Typed OM
* CSS Typed Object Model API
CSSUnitValue: unit property
===========================

 The **`CSSUnitValue.unit`** read-only property
 of the `CSSUnitValue` interface returns a string
 indicating the type of unit.

Value
-----

A string.

Examples
--------

 The following creates a `CSSPositionValue` from individual
 `CSSUnitValue` constructors, then queries the
 `CSSUnitValue.unit`.


```js
const pos = new CSSPositionValue(
  new CSSUnitValue(5, "px"),
  new CSSUnitValue(10, "em"),
);

console.log(pos.x.unit); // "px"
console.log(pos.y.unit); // "em"
```

Specifications
--------------

| Specification |
| --- |
| CSS Typed OM Level 1 # dom-cssunitvalue-unit |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `CSSUnitValue.value`
* Dimensions in CSS units and values
* Using the CSS Typed OM
* CSS Typed Object Model API
GPURenderPassEncoder: setViewport() method
==========================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

 The **`setViewport()`** method of the
 `GPURenderPassEncoder` interface sets the viewport used during the rasterization stage to linearly map from normalized device coordinates to viewport coordinates.

Syntax
------


```js
setViewport(x, y, width, height, minDepth, maxDepth)
```

### Parameters

`x`

A number representing the minimum X value of the viewport, in pixels.

`y`

A number representing the minimum Y value of the viewport, in pixels.

`width`

A number representing the width of the viewport, in pixels.

`height`

A number representing the height of the viewport, in pixels.

`minDepth`

A number representing the minimum depth value of the viewport.

`maxDepth`

A number representing the maximum depth value of the viewport.


**Note:** If a `setViewport()` call is not made, the default values are `(0, 0, attachment width, attachment height, 0, 1)` for each render pass.

### Return value

None (`Undefined`).

### Validation

The following criteria must be met when calling **`setViewport()`**, otherwise a `GPUValidationError` is generated and the `GPURenderPassEncoder` becomes invalid:

* `x`, `y`, `width`, and `height` are all greater than or equal to 0.
* `x` + `width` is less than or equal to the width of the render pass's render attachments (see note below).
* `y` + `height` is less than or equal to the height of the render pass's render attachments (see note below).
* `minDepth` and `maxDepth` are both inside the range 0.0–1.0 inclusive.
* `minDepth` is less than `maxDepth`.

**Note:** See the color and depth/stencil attachments specified in the descriptor of `GPUCommandEncoder.beginRenderPass()`; the width and height are based on that of the `GPUTexture` that their `view`s originate from.

Examples
--------

### Basic snippet

In a typical canvas render, the following could be used to halve the width and height of the rendered graphics:


```js
passEncoder.setViewport(0, 0, canvas.width / 2, canvas.height / 2, 0, 1);
```

### In context

In the WebGPU Samples reversedZ example, `setViewport` is used several times to set the viewport for the different render passes. Study the example code listing for the full context.

For example:


```js
// ...

colorPass.setViewport(
  (canvas.width \* m) / 2,
  0,
  canvas.width / 2,
  canvas.height,
  0,
  1,
);

// ...
```

Specifications
--------------

| Specification |
| --- |
| WebGPU # dom-gpurenderpassencoder-setviewport |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The WebGPU API
GPURenderPassEncoder: drawIndexed() method
==========================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

 The **`drawIndexed()`** method of the
 `GPURenderPassEncoder` interface draws indexed primitives based on the vertex and index buffers provided by `setVertexBuffer()` and `setIndexBuffer()`.

Syntax
------


```js
drawIndexed(indexCount)
drawIndexed(indexCount, instanceCount)
drawIndexed(indexCount, instanceCount, firstIndex)
drawIndexed(indexCount, instanceCount, firstIndex, baseVertex)
drawIndexed(indexCount, instanceCount, firstIndex, baseVertex, firstInstance)
```

### Parameters

`indexCount`

A number defining the number of indices to draw.

`instanceCount` Optional

A number defining the number of instances to draw. If omitted, `instanceCount` defaults to 1.

`firstIndex` Optional

A number defining the offset into the index buffer, in indices, to begin drawing from. If omitted, `firstIndex` defaults to 0.

`baseVertex` Optional

A number added to each index value before indexing into the vertex buffers. If omitted, `baseVertex` defaults to 0.

`firstInstance` Optional

A number defining the first instance to draw. If omitted, `firstInstance` defaults to 0.

### Return value

None (`Undefined`).

Examples
--------

In the WebGPU Samples Shadow Mapping example, `drawIndexed()` is used in two separate render passes in each animation frame, one to populate the shadow buffer and one to draw the primary view of the scene. Study the example code listing for the full context.


```js
// ...

const commandEncoder = device.createCommandEncoder();
{
  const shadowPass = commandEncoder.beginRenderPass(shadowPassDescriptor);
  shadowPass.setPipeline(shadowPipeline);
  shadowPass.setBindGroup(0, sceneBindGroupForShadow);
  shadowPass.setBindGroup(1, modelBindGroup);
  shadowPass.setVertexBuffer(0, vertexBuffer);
  shadowPass.setIndexBuffer(indexBuffer, "uint16");
  shadowPass.drawIndexed(indexCount);

  shadowPass.end();
}
{
  const renderPass = commandEncoder.beginRenderPass(renderPassDescriptor);
  renderPass.setPipeline(pipeline);
  renderPass.setBindGroup(0, sceneBindGroupForRender);
  renderPass.setBindGroup(1, modelBindGroup);
  renderPass.setVertexBuffer(0, vertexBuffer);
  renderPass.setIndexBuffer(indexBuffer, "uint16");
  renderPass.drawIndexed(indexCount);

  renderPass.end();
}

// ...
```

Specifications
--------------

| Specification |
| --- |
| WebGPU # dom-gpurendercommandsmixin-drawindexed |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The WebGPU API
GPURenderPassEncoder: setBlendConstant() method
===============================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

 The **`setBlendConstant()`** method of the
 `GPURenderPassEncoder` interface sets the constant blend color and alpha values used with `"constant"` and `"one-minus-constant"` blend factors (as set in the descriptor of the `GPUDevice.createRenderPipeline()` method, in the `blend` property).

Syntax
------


```js
setBlendConstant(color)
```

### Parameters

`color`

An object or array representing the color to use when blending — the `r`, `g`, `b`, and `a` components are represented as floating point numbers between 0.0 and 1.0.

What follows is an object example:


```js
const color = { r: 0.0, g: 0.5, b: 1.0, a: 1.0 };
```


The array equivalent would look like this:


```js
const color = [0.0, 0.5, 1.0, 1.0];
```


**Note:** If a `setBlendConstant()` call is not made, the blend constant color value defaults to `(0, 0, 0, 0)` for each render pass.

### Return value

None (`Undefined`).

Examples
--------


```js
// ...

const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);

passEncoder.setPipeline(renderPipeline);
passEncoder.setVertexBuffer(0, vertexBuffer);
passEncoder.setBlendConstant([1.0, 0.0, 0.0, 1.0]);
passEncoder.draw(3);

passEncoder.end();

// ...
```

Specifications
--------------

| Specification |
| --- |
| WebGPU # dom-gpurenderpassencoder-setblendconstant |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The WebGPU API