recursal/MDN huggingface dataset:
VRDisplayEvent: VRDisplayEvent() constructor
============================================

**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 **`VRDisplayEvent()`** constructor creates a `VRDisplayEvent` object.

**Note:** This constructor was part of the old WebVR API. It has been superseded by the WebXR Device API.

Syntax
------


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

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers set it to `vrdisplayconnect`, `vrdisplaydisconnect`, `vrdisplayactivate`, `vrdisplaydeactivate`, `vrdisplayblur`,
 `vrdisplaypointerrestricted`, `vrdisplaypointerunrestricted`, or `vrdisplaypresentchange`.


`options`

An object that, *in addition of the properties defined in `Event()`*, can have the following properties:

`display`

The `VRDisplay` the event is to be associated with.

`reason`

A string representing the human-readable reason why the event is to be fired (see `VRDisplayEvent.reason`).


### Return value

A new `VRDisplayEvent` object.

Examples
--------


```js
const myEventObject = new VRDisplayEvent("custom", {
  display: vrDisplay,
  reason: "Custom reason",
});
```

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

This constructor was part of the old WebVR API that has been superseded by the WebXR Device API. It is no longer on track to becoming a standard.

Until all browsers have implemented the new WebXR APIs, it is recommended to rely on frameworks, like A-Frame, Babylon.js, or Three.js, or a polyfill, to develop WebXR applications that will work across all browsers [1].

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

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

See also
--------

* WebVR API
VRDisplayEvent: display 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 **`display`** read-only property of the `VRDisplayEvent` interface returns the `VRDisplay` associated with this event.

**Note:** This property was part of the old WebVR API. It has been superseded by the WebXR Device API.

Value
-----

A `VRDisplay` object.

Examples
--------


```js
window.addEventListener("vrdisplaypresentchange", (e) => {
  console.log(
    `Display ${e.display.displayId} presentation has changed. Reason given: ${e.reason}.`,
  );
});
```

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

This property was part of the old WebVR API that has been superseded by the WebXR Device API. It is no longer on track to becoming a standard.

Until all browsers have implemented the new WebXR APIs, it is recommended to rely on frameworks, like A-Frame, Babylon.js, or Three.js, or a polyfill, to develop WebXR applications that will work across all browsers [1].

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

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

See also
--------

* WebVR API
VRDisplayEvent: reason 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 **`reason`** read-only property of the `VRDisplayEvent` interface returns a human-readable reason why the event was fired.

**Note:** This property was part of the old WebVR API. It has been superseded by the WebXR Device API.

Value
-----

A string representing the reason why the event was fired. The available reasons are defined in the `VRDisplayEventReason` enum, and are as follows:

* `mounted` — The `VRDisplay` has detected that the user has put it on (or it has been otherwise activated).
* `navigation` — The page has been navigated to from a context that allows this page to begin presenting immediately, such as from another site that was already in VR presentation mode.
* `requested` — The user agent has requested that VR presentation mode be started. This allows user agents to include a consistent UI to enter VR across different sites.
* `unmounted` — The `VRDisplay` has detected that the user has taken it off (or it has been otherwise slept/put on standby).
Examples
--------


```js
window.addEventListener("vrdisplaypresentchange", (e) => {
  console.log(
    `Display ${e.display.displayId} presentation has changed. Reason given: ${e.reason}.`,
  );
});
```

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

This property was part of the old WebVR API that has been superseded by the WebXR Device API. It is no longer on track to becoming a standard.

Until all browsers have implemented the new WebXR APIs, it is recommended to rely on frameworks, like A-Frame, Babylon.js, or Three.js, or a polyfill, to develop WebXR applications that will work across all browsers [1].

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

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

See also
--------

* WebVR API
USBConfiguration: configurationName property
============================================

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
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

 The **`configurationName`** read-only property
 of the `USBConfiguration` interface returns the name provided by the device
 to describe this configuration. This is equal to the value of the string descriptor with
 the index provided in the `iConfiguration`
 field of the configuration descriptor defining this configuration.

Value
-----

The name provided by the device to describe this configuration.

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

| Specification |
| --- |
| WebUSB API # ref-for-dom-usbconfiguration-configurationname |

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

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

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
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

 The **`configurationValue`** read-only property
 of the `USBConfiguration` interface returns the configuration value of this configuration. This is equal to the
 `bConfigurationValue` field of the configuration descriptor provided by the device defining this configuration.

Value
-----

 The configuration descriptor of the `USBDevice` specified in the constructor of the
 current `USBConfiguration` instance.

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

| Specification |
| --- |
| WebUSB API # ref-for-dom-usbconfiguration-configurationvalue |

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

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

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
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

 The **`interfaces`** read-only property of the
 `USBConfiguration` interface returns an array containing instances of the
 `USBInterface` describing each interface supported by this configuration.

Value
-----

An array containing instances of `USBInterface`.

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

| Specification |
| --- |
| WebUSB API # ref-for-dom-usbconfiguration-interfaces |

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

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

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
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

 The **`USBConfiguration()`** constructor
 creates a new `USBConfiguration` object which contains information about
 the configuration on the provided USBDevice with the given configuration value.

Syntax
------


```js
new USBConfiguration(device, configurationValue)
```

### Parameters

`device`

Specifies the `USBDevice` you want to configure.

`configurationValue`

Specifies the configuration descriptor you want to read. This is an unsigned integer in the range 0 to 255.

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

| Specification |
| --- |
| WebUSB API # dom-usbconfiguration-usbconfiguration |

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

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

The **`toJSON()`** method of the `TrustedScriptURL` 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 `sanitized` is an object created via a Trusted Types policy. The `toString()` method returns a string to safely use to load a third party script.


```js
const sanitized = scriptPolicy.createScriptURL(
  "https://example.com/my-script.js",
);
console.log(sanitized.toJSON());
```

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

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

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

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

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

Syntax
------


```js
toString()
```

### Parameters

None.

### Return value

A string containing the sanitized URL

Examples
--------

The constant `sanitized` is an object created via a Trusted Types policy. The `toString()` method returns a string to safely use to load a third party script.


```js
const sanitized = scriptPolicy.createScriptURL(
  "https://example.com/my-script.js",
);
console.log(sanitized.toString());
```

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

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

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

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

 The **`result`** read-only property of the
 `IDBRequest` interface returns the result of the request. If the request
 is not completed, the result is not available and an `InvalidStateError` exception is
 thrown.

**Note:** This feature is available in Web Workers

Value
-----

any

Examples
--------

 The following example requests a given record title, `onsuccess` gets the
 associated record from the `IDBObjectStore` (made available
 as `objectStoreTitleRequest.result`), updates
 one property of the record, and then puts the updated record back into the object
 store. For a full working example, see our To-do Notifications app (View the example live).


```js
const title = "Walk dog";

// Open up a transaction as usual
const objectStore = db
  .transaction(["toDoList"], "readwrite")
  .objectStore("toDoList");

// Get the to-do list object that has this title as it's title
const objectStoreTitleRequest = objectStore.get(title);

objectStoreTitleRequest.onsuccess = () => {
  // Grab the data object returned as the result
  const data = objectStoreTitleRequest.result;

  // Update the notified value in the object to "yes"
  data.notified = "yes";

  // Create another request that inserts the item
  // back into the database
  const updateTitleRequest = objectStore.put(data);

  // When this new request succeeds, run the displayData()
  // function again to update the display
  updateTitleRequest.onsuccess = () => {
    displayData();
  };
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbrequest-result① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).
IDBRequest: readyState property
===============================

 The **`readyState`** read-only property of the
 `IDBRequest` interface returns the state of the request.

 Every request starts in the `pending` state. The state changes to
 `done` when the request completes successfully or when an error
 occurs.

**Note:** This feature is available in Web Workers

Value
-----

One of the following strings:

`pending`

Returned if the request is still ongoing.

`done`

Returned if the request has already completed.

Examples
--------

 The following example requests a given record title, `onsuccess` gets the
 associated record from the `IDBObjectStore` (made available
 as `objectStoreTitleRequest.result`), updates
 one property of the record, and then puts the updated record back into the object
 store in another request. The `readyState` of the 2nd request is logged to
 the developer console. For a full working example, see our
 To-do Notifications app
 (View the example live).


```js
const title = "Walk dog";

// Open up a transaction as usual
const objectStore = db
  .transaction(["toDoList"], "readwrite")
  .objectStore("toDoList");

// Get the to-do list object that has this title as it's title
const objectStoreTitleRequest = objectStore.get(title);

objectStoreTitleRequest.onsuccess = () => {
  // Grab the data object returned as the result
  const data = objectStoreTitleRequest.result;

  // Update the notified value in the object to "yes"
  data.notified = "yes";

  // Create another request that inserts the item
  // back into the database
  const updateTitleRequest = objectStore.put(data);

  // Log the readyState of this request
  console.log(
    `The readyState of this request is ${updateTitleRequest.readyState}`,
  );

  // When this new request succeeds, run the displayData()
  // function again to update the display
  updateTitleRequest.onsuccess = () => {
    displayData();
  };
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbrequest-readystate① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).
IDBRequest: source property
===========================

 The **`source`** read-only property of the
 `IDBRequest` interface returns the source of the request, such as an
 Index or an object store. If no source exists (such as when calling
 `IDBFactory.open`), it returns null.

**Note:** This feature is available in Web Workers

Value
-----

 An object representing the source of the request, such as an `IDBIndex`,
 `IDBObjectStore` or `IDBCursor`.

Examples
--------

 The following example requests a given record title, `onsuccess` gets the
 associated record from the `IDBObjectStore` (made available
 as `objectStoreTitleRequest.result`), updates
 one property of the record, and then puts the updated record back into the object
 store in another request. The source of the 2nd request is logged to the developer
 console. For a full working example, see our To-do Notifications app (View the example live).


```js
const title = "Walk dog";

// Open up a transaction as usual
const objectStore = db
  .transaction(["toDoList"], "readwrite")
  .objectStore("toDoList");

// Get the to-do list object that has this title as its title
const objectStoreTitleRequest = objectStore.get(title);

objectStoreTitleRequest.onsuccess = () => {
  // Grab the data object returned as the result
  const data = objectStoreTitleRequest.result;

  // Update the notified value in the object to "yes"
  data.notified = "yes";

  // Create another request that inserts the item
  // back into the database
  const updateTitleRequest = objectStore.put(data);

  // Log the source of this request
  console.log(`The source of this request is ${updateTitleRequest.source}`);
  // When this new request succeeds, run the displayData()
  // function again to update the display
  updateTitleRequest.onsuccess = () => {
    displayData();
  };
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbrequest-source① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).
IDBRequest: success event
=========================

The `success` event is fired when an `IDBRequest` succeeds.

This event is not cancelable and does not bubble.

Syntax
------

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


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

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

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

A generic `Event`.

Examples
--------

This example tries to open a database and listens for the `success` event using `addEventListener()`:


```js
// Open the database
const openRequest = window.indexedDB.open("toDoList", 4);

openRequest.onupgradeneeded = (event) => {
  const db = event.target.result;

  db.onerror = () => {
    console.log("Error creating database");
  };

  // Create an objectStore for this database
  const objectStore = db.createObjectStore("toDoList", {
    keyPath: "taskTitle",
  });

  // define what data items the objectStore will contain
  objectStore.createIndex("hours", "hours", { unique: false });
  objectStore.createIndex("minutes", "minutes", { unique: false });
  objectStore.createIndex("day", "day", { unique: false });
  objectStore.createIndex("month", "month", { unique: false });
  objectStore.createIndex("year", "year", { unique: false });
};

openRequest.addEventListener("success", (event) => {
  console.log("Database opened successfully!");
});
```


The same example, but using the `onsuccess` event handler property:


```js
// Open the database
const openRequest = window.indexedDB.open("toDoList", 4);

openRequest.onupgradeneeded = (event) => {
  const db = event.target.result;

  db.onerror = () => {
    console.log("Error creating database");
  };

  // Create an objectStore for this database
  const objectStore = db.createObjectStore("toDoList", {
    keyPath: "taskTitle",
  });

  // define what data items the objectStore will contain
  objectStore.createIndex("hours", "hours", { unique: false });
  objectStore.createIndex("minutes", "minutes", { unique: false });
  objectStore.createIndex("day", "day", { unique: false });
  objectStore.createIndex("month", "month", { unique: false });
  objectStore.createIndex("year", "year", { unique: false });
};

openRequest.onsuccess = (event) => {
  console.log("Database opened successfully!");
};
```

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

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

See also
--------

* Using IndexedDB
HIDDevice: receiveFeatureReport() 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
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

The **`receiveFeatureReport()`** method of the `HIDDevice` interface receives a feature report from the HID device. Feature reports are a way for HID devices and applications to exchange non-standardized HID data.

The `reportId` for each of the report formats that this device supports can be retrieved from `HIDDevice.collections`.

Syntax
------


```js
receiveFeatureReport(reportId)
```

### Parameters

`reportId`

An 8-bit report ID. If the HID device does not use report IDs, send `0`.

### Return value

A `Promise` which resolves with a `DataView` object containing the feature report.

### Exceptions

`NotAllowedError` `DOMException`

Thrown if receiving the report fails for any reason.

Examples
--------

In the following example a report is received from a device using a `reportId` of `1`.


```js
const dataView = await device.receiveFeatureReport(1);
```

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

| Specification |
| --- |
| WebHID API # dom-hiddevice-receivefeaturereport |

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

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