recursal/MDN huggingface dataset:
IDBIndex: objectStore property
==============================

 The **`objectStore`** property of the `IDBIndex`
 interface returns the object store referenced by the current index.

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

Value
-----

An `IDBObjectStore`.

Examples
--------

 In the following example we open a transaction and an object store, then get the
 index `lName` from a simple contacts database. We then open a basic cursor on
 the index using `IDBIndex.openCursor`. This works the same as opening a
 cursor directly on an `ObjectStore` using
 `IDBObjectStore.openCursor` except that the returned records are sorted
 based on the index, not the primary key.

 The current object store is logged to the console: it should be returned something like
 this:


```json
IDBObjectStore { name: "contactsList", keyPath: "id", indexNames: DOMStringList[7], transaction: IDBTransaction, autoIncrement: false }
```


 Finally, we iterate through each record, and insert the data into an HTML table. For a
 complete working example, see our IndexedDB-examples demo repo (View the example live).


```js
function displayDataByIndex() {
  tableEntry.innerHTML = "";
  const transaction = db.transaction(["contactsList"], "readonly");
  const objectStore = transaction.objectStore("contactsList");

  const myIndex = objectStore.index("lName");
  console.log(myIndex.objectStore);

  myIndex.openCursor().onsuccess = (event) => {
    const cursor = event.target.result;
    if (cursor) {
      const tableRow = document.createElement("tr");
      tableRow.innerHTML =
        `<td>${cursor.value.id}</td>` +
        `<td>${cursor.value.lName}</td>` +
        `<td>${cursor.value.fName}</td>` +
        `<td>${cursor.value.jTitle}</td>` +
        `<td>${cursor.value.company}</td>` +
        `<td>${cursor.value.eMail}</td>` +
        `<td>${cursor.value.phone}</td>` +
        `<td>${cursor.value.age}</td>`;
      tableEntry.appendChild(tableRow);

      cursor.continue();
    } else {
      console.log("Entries all displayed.");
    }
  };
}
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbindex-objectstore① |

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).
IDBIndex: name property
=======================

 The **`name`** property of the `IDBIndex`
 interface contains a string which names the index.

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

Value
-----

A string specifying a name for the index.

### Exceptions

 There are a several exceptions that can occur when you attempt to change an index's
 name.

`InvalidStateError` `DOMException`

 Thrown if the index, or its object store, has been deleted or if the current transaction is not
 an upgrade transaction. You can only rename indexes during upgrade transactions; that
 is, when the mode is `"versionchange"`.


`TransactionInactiveError` `DOMException`

Thrown if the current transaction is not active.

`ConstraintError` `DOMException`

Thrown if an index is already using the specified `name`.

Examples
--------

 In the following example we open a transaction and an object store, then get the
 index `lName` from a simple contacts database. We then open a basic cursor on
 the index using `IDBIndex.openCursor()` — this works the same as opening a
 cursor directly on an `IDBObjectStore` using
 `openCursor()` except that the returned
 records are sorted based on the index, not the primary key.

 The name of the index is logged to the console: it should be returned as
 `lName`.

 Finally, we iterate through each record, inserting the data into an HTML table. For a
 complete working example, see our IndexedDB-examples demo repo (View the example live).


```js
function displayDataByIndex() {
  tableEntry.innerHTML = "";
  const transaction = db.transaction(["contactsList"], "readonly");
  const objectStore = transaction.objectStore("contactsList");

  const myIndex = objectStore.index("lName");
  console.log(myIndex.name);

  myIndex.openCursor().onsuccess = (event) => {
    const cursor = event.target.result;
    if (cursor) {
      const tableRow = document.createElement("tr");
      tableRow.innerHTML =
        `<td>${cursor.value.id}</td>` +
        `<td>${cursor.value.lName}</td>` +
        `<td>${cursor.value.fName}</td>` +
        `<td>${cursor.value.jTitle}</td>` +
        `<td>${cursor.value.company}</td>` +
        `<td>${cursor.value.eMail}</td>` +
        `<td>${cursor.value.phone}</td>` +
        `<td>${cursor.value.age}</td>`;
      tableEntry.appendChild(tableRow);

      cursor.continue();
    } else {
      console.log("Entries all displayed.");
    }
  };
}
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbindex-name① |

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).
IDBIndex: getAll() method
=========================

 The **`getAll()`** method of the `IDBIndex`
 interface retrieves all objects that are inside the index.

 There is a performance cost associated with looking at the `value` property
 of a cursor, because the object is created lazily. To use a feature
 like `getAll()`, the browser has to create all the objects at once. If you
 are just interested in looking at each of the keys, for instance, it is more efficient
 to use a cursor. If you are trying to get an
 array of all the objects in an object store, though, you should
 use `getAll()`.

Syntax
------


```js
getAll()
getAll(query)
getAll(query, count)
```

### Parameters

`query` Optional

 A key or an `IDBKeyRange` identifying the records to retrieve. If this
 value is null or missing, the browser will use an unbound key range.


`count` Optional

 The number of records to return. If this value exceeds the number of records in the
 query, the browser will only retrieve the queried records. If it is lower than
 `0` or greater than `2^32 - 1` a `TypeError`
 exception will be thrown.


### Return value

An `IDBRequest` object on which subsequent events related to this operation are fired.

If the operation is successful, the value of the request's `result` property is an `Array` of the values of all records matching the given query, up to the value of `count`, if `count` was supplied.

### Exceptions

This method may raise a `DOMException` of the following types:

`TransactionInactiveError` `DOMException`

Thrown if this `IDBIndex`'s transaction is inactive.

`InvalidStateError` `DOMException`

Thrown if the `IDBIndex` has been deleted or removed.


 A `TypeError` exception is thrown if the `count` parameter is
 not between `0` and `2^32 - 1` included.

Examples
--------


```js
const myIndex = objectStore.index("index");
const getAllRequest = myIndex.getAll();
getAllRequest.onsuccess = () => {
  console.log(getAllRequest.result);
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbindex-getall① |

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).
IDBIndex: unique property
=========================

 The **`unique`** read-only property returns a boolean that
 states whether the index allows duplicate keys.

 This is decided when the index is created, using the
 `IDBObjectStore.createIndex` method. This method takes an optional
 parameter, `unique`, which if set to `true` means that the index
 will not be able to accept duplicate entries.

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

Value
-----

A boolean value:

| Value | Effect |
| --- | --- |
| `true` | The current index does not allow duplicate values for a key. |
| `false` | The current index allows duplicate key values. |

Examples
--------

 In the following example we open a transaction and an object store, then get the
 index `lName` from a simple contacts database. We then open a basic cursor on
 the index using `IDBIndex.openCursor` — this works the same as opening a
 cursor directly on an `ObjectStore` using
 `IDBObjectStore.openCursor` except that the returned records are sorted
 based on the index, not the primary key.

 The unique status of the index is logged to the console: it should be returned
 as `false`.

 Finally, we iterate through each record, and insert the data into an HTML table. For a
 complete working example, see our IndexedDB-examples demo repo (View the example live).


```js
function displayDataByIndex() {
  tableEntry.innerHTML = "";
  const transaction = db.transaction(["contactsList"], "readonly");
  const objectStore = transaction.objectStore("contactsList");

  const myIndex = objectStore.index("lName");
  console.log(myIndex.unique);

  myIndex.openCursor().onsuccess = (event) => {
    const cursor = event.target.result;
    if (cursor) {
      const tableRow = document.createElement("tr");
      tableRow.innerHTML =
        `<td>${cursor.value.id}</td>` +
        `<td>${cursor.value.lName}</td>` +
        `<td>${cursor.value.fName}</td>` +
        `<td>${cursor.value.jTitle}</td>` +
        `<td>${cursor.value.company}</td>` +
        `<td>${cursor.value.eMail}</td>` +
        `<td>${cursor.value.phone}</td>` +
        `<td>${cursor.value.age}</td>`;
      tableEntry.appendChild(tableRow);

      cursor.continue();
    } else {
      console.log("Entries all displayed.");
    }
  };
}
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # dom-idbindex-unique |

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).
IDBIndex: getAllKeys() method
=============================

 The **`getAllKeys()`** method of the `IDBIndex`
 interface asynchronously retrieves the primary keys of all objects inside the index,
 setting them as the `result` of the request object.

Syntax
------


```js
getAllKeys()
getAllKeys(query)
getAllKeys(query, count)
```

### Parameters

`query` Optional

 A key or an `IDBKeyRange` identifying the keys to retrieve. If this
 value is null or missing, the browser will use an unbound key range.


`count` Optional

 The number records to return. If this value exceeds the number of records in the
 query, the browser will only retrieve the first item. If it is lower than
 `0` or greater than `2^32 - 1` a `TypeError`
 exception will be thrown.


### Return value

An `IDBRequest` object on which subsequent events related to this operation are fired.

If the operation is successful, the value of the request's `result` property is an `Array` of the keys for all records matching the given query, up to the value of `count`, if `count` was supplied.

### Exceptions

This method may raise a `DOMException` of the following types:

`TransactionInactiveError` `DOMException`

Thrown if this `IDBIndex`'s transaction is inactive.

`InvalidStateError` `DOMException`

Thrown if the `IDBIndex` has been deleted or removed.


 A `TypeError` exception is thrown if the `count` parameter is
 not between `0` and `2^32 - 1` included.

Examples
--------


```js
const myIndex = objectStore.index("index");
const getAllKeysRequest = myIndex.getAllKeys();
getAllKeysRequest.onsuccess = () => {
  console.log(getAllKeysRequest.result);
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbindex-getallkeys① |

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).
IDBIndex: keyPath property
==========================

 The **`keyPath`** property of the `IDBIndex`
 interface returns the key path of the current index. If null, this index is not auto-populated.

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

Value
-----

Any data type that can be used as a key path.

Examples
--------

 In the following example we open a transaction and an object store, then get the
 index `lName` from a simple contacts database. We then open a basic cursor on
 the index using `IDBIndex.openCursor` — this works the same as opening a
 cursor directly on an `ObjectStore` using
 `IDBObjectStore.openCursor` except that the returned records are sorted
 based on the index, not the primary key.

 The key path of the current index is logged to the console: it should be returned
 as `lName`.

 Finally, we iterate through each record, and insert the data into an HTML table. For a
 complete working example, see our IndexedDB-examples demo repo (View the example live).


```js
function displayDataByIndex() {
  tableEntry.innerHTML = "";
  const transaction = db.transaction(["contactsList"], "readonly");
  const objectStore = transaction.objectStore("contactsList");

  const myIndex = objectStore.index("lName");
  console.log(myIndex.keyPath);

  myIndex.openCursor().onsuccess = (event) => {
    const cursor = event.target.result;
    if (cursor) {
      const tableRow = document.createElement("tr");
      tableRow.innerHTML =
        `<td>${cursor.value.id}</td>` +
        `<td>${cursor.value.lName}</td>` +
        `<td>${cursor.value.fName}</td>` +
        `<td>${cursor.value.jTitle}</td>` +
        `<td>${cursor.value.company}</td>` +
        `<td>${cursor.value.eMail}</td>` +
        `<td>${cursor.value.phone}</td>` +
        `<td>${cursor.value.age}</td>`;
      tableEntry.appendChild(tableRow);

      cursor.continue();
    } else {
      console.log("Entries all displayed.");
    }
  };
}
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # dom-idbindex-keypath |

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).
GamepadHapticActuator: pulse() method
=====================================

The **`pulse()`** method of the `GamepadHapticActuator` interface makes the hardware pulse at a certain intensity for a specified duration.

Syntax
------


```js
pulse(value, duration)
```

### Parameters

`value`

A double representing the intensity of the pulse. This can vary depending on the hardware type, but generally takes a value between 0.0 (no intensity) and 1.0 (full intensity).

`duration`

A double representing the duration of the pulse, in milliseconds.


**Note:** Repeated calls to `pulse()` override the previous calls if they are still ongoing.

### Return value

A promise that resolves with a value of `true` when the pulse has successfully completed.

Examples
--------


```js
const gamepad = navigator.getGamepads()[0];

gamepad.hapticActuators[0].pulse(1.0, 200);
```

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

| Specification |
| --- |
| Gamepad Extensions # dom-gamepadhapticactuator-pulse |

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

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

See also
--------

* Gamepad API
GamepadHapticActuator: playEffect() method
==========================================

**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 **`playEffect()`** method of the `GamepadHapticActuator` interface makes the hardware play a specific vibration pattern.

Syntax
------


```js
playEffect(type, params)
```

### Parameters

`type`

A string representing the desired effect. This can vary depending on the hardware type. Possible values are "dual-rumble" or "vibration".

`params`

An object to describe a desired haptic effect.

Expected values are:

`duration`

The duration of the effect in milliseconds.

`startDelay`

The delay in milliseconds before the effect is started.

`strongMagnitude`

Rumble intensity of the low-frequency (strong) rumble motors, normalized to the range between 0.0 and 1.0.

`weakMagnitude`

Rumble intensity of the high-frequency (weak) rumble motors, normalized to the range between 0.0 and 1.0.


**Note:** A new call to `playEffect()` overrides a previous ongoing call.

### Return value

A promise that resolves with `true` when the playEffect successfully completes.

Examples
--------


```js
const gamepad = navigator.getGamepads()[0];

gamepad.vibrationActuator.playEffect("dual-rumble", {
  startDelay: 0,
  duration: 200,
  weakMagnitude: 1.0,
  strongMagnitude: 1.0,
});
```

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

#### No specification found

No specification data found for `api.GamepadHapticActuator.playEffect`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

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

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

See also
--------

* Gamepad API
GamepadHapticActuator: type property
====================================

The **`type`** read-only property of the `GamepadHapticActuator` interface returns an enum representing the type of the haptic hardware.

Value
-----

An enum of type `GamepadHapticActuatorType`; currently available types are:

* `vibration` — vibration hardware, which creates a rumbling effect.
Examples
--------

TBC

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

| Specification |
| --- |
| Gamepad Extensions # dom-gamepadhapticactuatortype |

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

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

See also
--------

* Gamepad API
PaymentResponse: payerEmail property
====================================

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

**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 `payerEmail` read-only property of the `PaymentResponse`
 interface returns the email address supplied by the user. This option is only present
 when the `requestPayerEmail` option is set to `true` in the
 `PaymentOptions` object passed to the
 `PaymentRequest` constructor.

Value
-----

A string.

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

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

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

**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 **`shippingOption`** read-only property of
 the `PaymentRequest` interface returns the ID attribute of the shipping
 option selected by the user. This option is only present when the
 `requestShipping` option is set to `true` in the
 `PaymentOptions` object passed to the
 `PaymentRequest` constructor.

Value
-----

A string.

Examples
--------

 In the example below, the `shippingoptionchange` event
 is called. It calls `updateDetails()` to toggle the shipping method between
 "standard" and "express".


```js
// Initialization of PaymentRequest arguments are excerpted for brevity.
const payment = new PaymentRequest(supportedInstruments, details, options);

request.addEventListener("shippingoptionchange", (evt) => {
  evt.updateWith(
    new Promise((resolve, reject) => {
      updateDetails(details, request.shippingOption, resolve, reject);
    }),
  );
});

payment
  .show()
  .then((paymentResponse) => {
    // Processing of paymentResponse excerpted for the same of brevity.
  })
  .catch((err) => {
    console.error("Uh oh, something bad happened", err.message);
  });

function updateDetails(details, shippingOption, resolve, reject) {
  let selectedShippingOption;
  let otherShippingOption;
  if (shippingOption === "standard") {
    selectedShippingOption = details.shippingOptions[0];
    otherShippingOption = details.shippingOptions[1];
    details.total.amount.value = "55.00";
  } else if (shippingOption === "express") {
    selectedShippingOption = details.shippingOptions[1];
    otherShippingOption = details.shippingOptions[0];
    details.total.amount.value = "67.00";
  } else {
    reject(`Unknown shipping option '${shippingOption}'`);
    return;
  }
  selectedShippingOption.selected = true;
  otherShippingOption.selected = false;
  details.displayItems.splice(2, 1, selectedShippingOption);
  resolve(details);
}
```

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

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