recursal/MDN huggingface dataset:
AudioParam: maxValue property
=============================

 The **`maxValue`**
 read-only property of the `AudioParam` interface represents the maximum
 possible value for the parameter's nominal (effective) range.

Value
-----

 A floating-point `Number` indicating the maximum value permitted for the
 parameter's nominal range.

 The default value of `maxValue` is the maximum positive single-precision
 floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440).

Examples
--------


```js
const audioCtx = new AudioContext();
const gainNode = audioCtx.createGain();
console.log(gainNode.gain.maxValue); // 3.4028234663852886e38
```

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

| Specification |
| --- |
| Web Audio API # dom-audioparam-maxvalue |

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

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

See also
--------

* `AudioParam.minValue`
AudioParam: cancelScheduledValues() method
==========================================

 The `cancelScheduledValues()` method of the `AudioParam`
 Interface cancels all scheduled future changes to the `AudioParam`.

Syntax
------


```js
cancelScheduledValues(startTime)
```

### Parameters

`startTime`

 A double representing the time (in seconds) after the `AudioContext`
 was first created after which all scheduled changes will be cancelled.


### Return value

 A reference to this `AudioParam` object. In some older implementations this
 method returns `undefined`.

Examples
--------


```js
const gainNode = audioCtx.createGain();
gainNode.gain.setValueCurveAtTime(waveArray, audioCtx.currentTime, 2); //'gain' is the AudioParam
gainNode.gain.cancelScheduledValues(audioCtx.currentTime);
```

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

| Specification |
| --- |
| Web Audio API # dom-audioparam-cancelscheduledvalues |

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

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

See also
--------

* Using the Web Audio API
AudioParam: defaultValue property
=================================

 The **`defaultValue`**
 read-only property of the `AudioParam` interface represents the initial
 value of the attributes as defined by the specific `AudioNode` creating
 the `AudioParam`.

Value
-----

A floating-point `Number`.

Examples
--------


```js
const audioCtx = new AudioContext();
const gainNode = audioCtx.createGain();
const defaultVal = gainNode.gain.defaultValue;
console.log(defaultVal); // 1
console.log(defaultVal === gainNode.gain.value); // true
```

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

| Specification |
| --- |
| Web Audio API # dom-audioparam-defaultvalue |

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

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

See also
--------

* Using the Web Audio API
CompositionEvent: data property
===============================

 The **`data`** read-only property of the
 `CompositionEvent` interface returns the characters generated by the input
 method that raised the event; its exact nature varies depending on the type of event
 that generated the `CompositionEvent` object.

Value
-----

A string representing the event data:

* For `compositionstart` events, this is the currently selected text that
 will be replaced by the string being composed. This value doesn't change even if
 content changes the selection range; rather, it indicates the string that was selected
 when composition started.
* For `compositionupdate`, this is the string as it stands currently as
 editing is ongoing.
* For `compositionend` events, this is the string as committed to the
 editor.
Specifications
--------------

| Specification |
| --- |
| UI Events # dom-compositionevent-data |

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

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

See also
--------

* `CompositionEvent`
CompositionEvent: locale property
=================================

**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.

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

 The **`locale`** read-only property of the
 `CompositionEvent` interface returns the locale of current input method
 (for example, the keyboard layout locale if the composition is associated with IME).


**Warning:** Even for browsers supporting it, don't trust the value contained in this property.
 Even if technically it is accessible, the way to set it up when creating a `CompositionEvent`
 is not guaranteed to be coherent.


Value
-----

A string representing the locale of current input method.

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

 This property was in early versions of different specifications. It is now only kept for compatibility purposes, and the way
 to set its value when creating a `CompositionEvent` is not well defined.

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

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

See also
--------

* `CompositionEvent`
CompositionEvent: initCompositionEvent() 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 **`initCompositionEvent()`**
 method of the `CompositionEvent` interface initializes the attributes of a
 `CompositionEvent` object instance.


**Note:** The correct way of creating a `CompositionEvent` is to use
 the constructor `CompositionEvent()`.


Syntax
------


```js
initCompositionEvent(type, canBubble, cancelable, view, data, locale)
```

### Parameters

`type`

 A string representing the type of composition event; this will be
 one of `compositionstart`, `compositionupdate`, or
 `compositionend`.


`canBubble`

A boolean value specifying whether or not the event can bubble.

`cancelable`

A boolean value indicating whether or not the event can be canceled.

`view`

The `Window` object from which the event was generated.

`data`

 A string representing the value of the `data`
 attribute.


`locale`

 A string representing the value of the `locale`
 attribute.


### Return value

None (`undefined`).

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

This method is no longer on a standardization track. It is kept for compatibility purposes. Use the constructor `CompositionEvent()`.

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

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

See also
--------

* `CompositionEvent`
CompositionEvent: CompositionEvent() constructor
================================================

The **`CompositionEvent()`** constructor creates a new `CompositionEvent` object.

Syntax
------


```js
new CompositionEvent(type)
new CompositionEvent(type, options)
```

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers set it to `compositionstart`, `compositionupdate`, or `compositionend`.


`options` Optional

An object that, *in addition of the properties defined in `UIEvent()`*, has the following properties:

`data` Optional

 A string used to initialize the `data` property of the new
 `CompositionEvent`. Browser-generated events set it to the characters generated by the IME
 composition.



### Return value

A new `CompositionEvent` object.

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

| Specification |
| --- |
| UI Events # dom-compositionevent-compositionevent |

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

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

See also
--------

* `CompositionEvent`, the interface of the objects it constructs.
XRView: recommendedViewportScale property
=========================================

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

The read-only **`recommendedViewportScale`** property of the `XRView` interface is the recommended viewport scale value that you can use for `XRView.requestViewportScale()` if the user agent has such a recommendation; `null` otherwise.

Value
-----

A number greater than 0.0 and less than or equal to 1.0; or `null` if the user agent does not provide a recommended scale.

Examples
--------

### Dynamic viewport scaling

Dynamic viewport scaling allows applications to only use a subset of the available `framebuffer`. The feature may not be available on all systems since it depends on driver support, so you might want to ensure that `XRView.requestViewportScale` exists before calling it.


```js
for (const view of pose.views) {
  if (view.requestViewportScale) {
    view.requestViewportScale(view.recommendedViewportScale);
  }
  const viewport = glLayer.getViewport(view);
}
```

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

| Specification |
| --- |
| WebXR Device API # dom-xrview-recommendedviewportscale |

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

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

See also
--------

* `XRView.requestViewportScale()`
XRView: projectionMatrix property
=================================

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

 The `XRView` interface's read-only
 **`projectionMatrix`** property specifies the projection matrix
 to apply to the underlying view. This should be used to integrate perspective to
 everything in the scene, in order to ensure the result is consistent with what the eye
 expects to see.


**Note:** Failure to apply proper perspective, or inconsistencies
 in perspective, may result in possibly serious user discomfort or distress.


Value
-----

 A `Float32Array` object representing the projection matrix for the view.
 The projection matrix for each eye's view is used to ensure that the correct area of the
 scene is presented to each eye in order to create a believable 3D scene without
 introducing discomfort for the user.

Examples
--------

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

| Specification |
| --- |
| WebXR Device API # dom-xrview-projectionmatrix |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRView: eye property
====================

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

 The `XRView` interface's read-only **`eye`**
 property is a string indicating which eye's viewpoint the `XRView` represents: `left` or
 `right`. For views which represent neither eye, such as monoscopic views,
 this property's value is `none`.

Value
-----

A string that can be one of the following values:

`left`

The `XRView` represents the point-of-view of the viewer's left eye.

`right`

The view represents the viewer's right eye.

`none`

The `XRView` describes a monoscopic view, or the view otherwise doesn't represent a particular eye's point-of-view.

Usage notes
-----------

 The primary purpose of this property is to allow the correct area of any pre-rendered
 stereo content to be presented to the correct eye. For dynamically-rendered 3D content,
 you can usually ignore this and render each of the viewer's views, one after another.

Examples
--------

 This code, from the viewer pose's renderer, iterates over the pose's views and renders
 them. *However*, we have flags which, if `true`, indicate that a
 particular eye has been injured during gameplay. When rendering that eye, if the flag is
 `true`, that view is skipped instead of being rendered.


```js
glLayer = xrSession.renderState.baseLayer;
gl.bindFramebuffer(gl.FRAMEBUFFER, glLayer.framebuffer);
gl.clearColor(0, 0, 0, 1.0);
gl.clearDepth(1.0);
gl.clear(gl.COLOR\_BUFFER\_BIT, gl.DEPTH\_BUFFER\_BIT);

for (const view of xrPose.views) {
  let skipView = false;

  if (view.eye === "left" && body.leftEye.injured) {
    skipView = updateInjury(body.leftEye);
  } else if (view.eye === "right" && body.rightEye.injured) {
    skipView = updateInjury(body.rightEye);
  }

  if (!skipView) {
    let viewport = glLayer.getViewport(view);
    gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
    renderScene(gl, view);
  }
}
```


 For each of the views, the value of `eye` is checked and if it's either
 `left` or `right`, we check to see if the
 `body.leftEye.injured` or `body.rightEye.injured` property is
 `true`; if so, we call a function `updateInjury()` on that eye to
 do things such as allow a bit of healing to occur, track the progress of a poison
 effect, or the like, as appropriate for the game's needs.

`updateInjury()` returns `true` if the eye is still injured or
 `false` if the eye has been restored to health by the function. If the
 result is `false`, indicating that the eye is now healthy, we render the
 scene for that eye. Otherwise, we don't.

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

| Specification |
| --- |
| WebXR Device API # dom-xrview-eye |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRView: isFirstPersonObserver property
======================================

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

The `XRView` interface's read-only **`isFirstPersonObserver`** property is a boolean indicating if the `XRView` is a first-person observer view.

To create video recordings of AR device cameras, you can't simply use one of the rendered eyes, as there often will be a physical offset. Some devices expose a secondary view, the first-person observer view, which has an `eye` of `none`.

To receive a first-person observer view, you need to enable the "secondary-views" feature descriptor explicitly (typically as an optional feature). See `XRSystem.requestSession()` for details.

The `isFirstPersonObserver` property then allows you to check which secondary view is a first-person observer view.

Examples
--------

### Checking for first-person observer views


```js
// Make sure to enable "secondary-view"
navigator.xr
  .requestSession("immersive-ar", {
    optionalFeatures: ["secondary-views"],
  })
  .then((session) => {
    // …

    session.requestAnimationFrame((frame) => {
      const views = frame.getViewerPose(space);
      // Make sure to iterate over all views
      for (const view of views) {
        if (view.isFirstPersonObserver) {
          renderFPO();
        } else {
          render();
        }
      }
    });
  });
```

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

| Specification |
| --- |
| WebXR Augmented Reality Module - Level 1 # dom-xrview-isfirstpersonobserver |

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

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

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

The **`requestViewportScale()`** method of the `XRView` interface requests that the user agent sets the requested viewport scale for this viewport to the given value. This is used for dynamic viewport scaling which allows rendering to a subset of the WebXR viewport using a scale factor that can be changed every animation frame.

Syntax
------


```js
requestViewportScale(scale)
```

Parameters
----------

`scale`

A number greater than 0.0 and less than or equal to 1.0 representing the scale factor.

Return value
------------

None (`undefined`).

Dynamic viewport scaling
------------------------

Dynamic viewport scaling allows applications to only use a subset of the available `framebuffer`. The feature may not be available on all systems since it depends on driver support, so you might want to ensure that `requestViewportScale()` exists before calling it.

The `scale` parameter can be a number greater than 0.0 and less than or equal to 1.0.

Alternatively, you can use the `XRView.recommendedViewportScale` property which contains the user agent's recommended value based on internal heuristics. If the user agent doesn't provide a recommended viewport scale, its value is `null` and the call to `requestViewportScale()` is ignored.

Examples
--------

The following example shows how to request and apply a new viewport scale. The call to `XRWebGLLayer.getViewport()` applies the change and returns the updated viewport.


```js
for (const view of pose.views) {
  if (view.requestViewportScale) {
    view.requestViewportScale(0.8);
    // or use view.requestViewportScale(view.recommendedViewportScale);
  }
  const viewport = glLayer.getViewport(view);
}
```

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

| Specification |
| --- |
| WebXR Device API # dom-xrview-requestviewportscale |

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

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

See also
--------

* `XRView.recommendedViewportScale`
USB: connect event
==================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`connect`** event of the `USB` interface is fired whenever a paired device is connected.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("connect", (event) => {});

onconnect = (event) => {};
```

Event type
----------

A `USBConnectionEvent`. Inherits from `Event`.

Event

USBConnectionEventEvent properties
----------------

*In addition to the properties listed below, properties from the parent interface, `Event`, are available.*

`device` Read only 

The `USBDevice` the event is fired for.

Examples
--------

Once a USB device is connected, you might want to update the UI.


```js
navigator.usb.addEventListener("connect", (event) => {
  // Add event.device to the UI.
});
```


Alternatively, you can use the `USB.onconnect` event handler property to establish a handler for the `connect` event:


```js
navigator.usb.onconnect = (event) => {
  // Add event.device to the UI.
};
```

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

| Specification |
| --- |
| WebUSB API # connect |
| WebUSB API # ref-for-dom-usb-onconnect |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

 The **`requestDevice()`** method of the `USB`
 interface returns a `Promise` that resolves with an instance of
 `USBDevice` if the specified device is found. Calling this function
 triggers the user agent's pairing flow.

Syntax
------


```js
requestDevice(filters)
```

### Parameters

`filters`

 An array of filter objects for possible devices you would like to pair. Each filter
 object can have the following properties:


* `vendorId`
* `productId`
* `classCode`
* `subclassCode`
* `protocolCode`
* `serialNumber`

### Return value

A `Promise` that resolves with an instance of `USBDevice`.

Security
--------

Transient user activation is required. The user has to interact with the page or a UI element in order for this feature to work.

Examples
--------

 The following example looks for one of two USB devices. Notice that two product IDs are
 specified. Both are passed to `requestDevice()`. This triggers a user-agent
 flow that prompts the user to select a device for pairing. Only the selected device is
 passed to `then()`.

 The number of filters does not specify the number of devices shown by the user agent.
 For example, if only a USB device with product ID `0xa800` is found, then
 only one device will be listed by the user agent. On the other hand if the user agent
 finds two of the first listed device and one of the second, then all three devices will
 be listed.


```js
const filters = [
  { vendorId: 0x1209, productId: 0xa800 },
  { vendorId: 0x1209, productId: 0xa850 },
];
navigator.usb
  .requestDevice({ filters })
  .then((usbDevice) => {
    console.log(`Product name: ${usbDevice.productName}`);
  })
  .catch((e) => {
    console.error(`There is no device. ${e}`);
  });
```

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

| Specification |
| --- |
| WebUSB API # ref-for-dom-usb-requestdevice④ |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
USB: disconnect event
=====================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`disconnect`** event of the `USB` interface is fired whenever a paired device is disconnected.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("disconnect", (event) => {});

ondisconnect = (event) => {};
```

Event type
----------

A `USBConnectionEvent`. Inherits from `Event`.

Event

USBConnectionEventEvent properties
----------------

*In addition to the properties listed below, properties from the parent interface, `Event`, are available.*

`device` Read only 

The `USBDevice` the event is fired for.

Examples
--------

Once a USB device is disconnected, you might want to update the UI.


```js
navigator.usb.addEventListener("disconnect", (event) => {
  // Remove event.device from the UI.
});
```


Alternatively, you can use the `USB.ondiscconnect` event handler property to establish a handler for the `disconnect` event:


```js
navigator.usb.ondisconnect = (event) => {
  // Remove event.device from the UI.
};
```

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

| Specification |
| --- |
| WebUSB API # disconnect |
| WebUSB API # ref-for-dom-usb-ondisconnect |

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

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