recursal/MDN huggingface dataset:
ScreenDetailed: left property
=============================

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

 The **`left`** read-only property of the
 `ScreenDetailed` interface is a number representing the x-coordinate (left-hand edge) of the total screen area inside the OS virtual screen arrangement, relative to the multi-screen origin.

This is equal to the true left-hand edge, ignoring any OS UI element drawn at the left of the screen. Windows cannot be placed in those areas; to get the left-hand coordinate of the screen area that windows can be placed in, use `ScreenDetailed.availLeft`.

**Note:** In Firefox, a non-standard implementation of the `left` property is available on the `Screen` interface. See the Non-standard example below for usage details, and see the `Screen` reference page for browser support information relating to the non-standard implementation.

Value
-----

A number.

Examples
--------

### Window Management API example


```js
// Available in browsers that support the Window Management API
const screenDetails = await window.getScreenDetails();

// Return the absolute left value of the first screen
const screen1Left = screenDetails.screens[0].left;
```

### Non-standard example


```js
// Available in Firefox
// Return the absolute left value of the current screen
const screenLeft = window.screen.left;
```

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

| Specification |
| --- |
| Window Management # ref-for-dom-screendetailed-left |

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

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

See also
--------

* Window Management API
ScreenDetailed: label property
==============================

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

 The **`label`** read-only property of the
 `ScreenDetailed` interface is a string providing a descriptive label for the screen, for example "Built-in Retina Display".

This is useful for constructing a list of options to display to the user if you want them to choose a screen to display content on.

Value
-----

A string.

Examples
--------


```js
const screenDetails = await window.getScreenDetails();

// Return the label of the first screen
const screen1Label = screenDetails.screens[0].label;
```

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

| Specification |
| --- |
| Window Management # ref-for-dom-screendetailed-label |

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

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

See also
--------

* Window Management API
ScreenDetailed: isInternal property
===================================

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

 The **`isInternal`** read-only property of the
 `ScreenDetailed` interface is a boolean indicating whether the screen is internal to the device or external. External devices are generally manufactured separately from the device they are attached to and can be connected and disconnected as needed, whereas internal screens are part of the device and not intended to be disconnected.

Value
-----

A boolean value — `true` if the screen is internal, and `false` if it is external.

Examples
--------


```js
const screenDetails = await window.getScreenDetails();

// Is the first screen internal?
const screen1Internal = screenDetails.screens[0].isInternal;
```

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

| Specification |
| --- |
| Window Management # ref-for-dom-screendetailed-isinternal |

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

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

See also
--------

* Window Management API
ScreenDetailed: availTop property
=================================

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

 The **`availTop`** read-only property of the
 `ScreenDetailed` interface is a number representing the y-coordinate (top edge) of the available screen area inside the OS virtual screen arrangement, relative to the multi-screen origin.

This is equal to the `ScreenDetailed.top` property, plus the height of any OS UI element drawn at the top of the screen. Windows cannot be placed in those areas, so `availTop` is useful for giving you the top boundary of the actual area available to open or place windows.

**Note:** A non-standard implementation of the `availTop` property is available on the `Screen` interface in all browsers. See the Non-standard example below for usage details, and see the `Screen` reference page for browser support information relating to the non-standard implementation.

Value
-----

A number.

Examples
--------

### Window Management API example


```js
// Available in browsers that support the Window Management API
const screenDetails = await window.getScreenDetails();

// Return the availTop value of the first screen
const screen1AvailTop = screenDetails.screens[0].availTop;
```

### Non-standard example


```js
// Available in all browsers
// Return the availTop value of the current screen
const screenAvailTop = window.screen.availTop;
```

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

| Specification |
| --- |
| Window Management # ref-for-dom-screendetailed-availtop |

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

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

See also
--------

* Window Management API
ScreenDetailed: isPrimary property
==================================

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

 The **`isPrimary`** read-only property of the
 `ScreenDetailed` interface is a boolean indicating whether the screen is set as the operating system (OS) primary screen or not.

The OS hosting the browser will have one primary screen, and one or more secondary screens. The primary screen can usually be specified by the user via OS settings, and generally contains OS UI features such as the taskbar/icon dock. The primary screen may change for a number of reasons, such as a screen being unplugged.

Value
-----

A boolean value — `true` if the screen is primary, and `false` if it is secondary.

Examples
--------


```js
const screenDetails = await window.getScreenDetails();

// Is the first screen primary?
const screen1Primary = screenDetails.screens[0].isPrimary;
```

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

| Specification |
| --- |
| Window Management # ref-for-dom-screendetailed-isprimary |

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

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

See also
--------

* Window Management API
ExtendableEvent: waitUntil() method
===================================

 The **`ExtendableEvent.waitUntil()`**
 method tells the event dispatcher that work is ongoing. It can also be used to detect
 whether that work was successful. In service workers, `waitUntil()` tells
 the browser that work is ongoing until the promise settles, and it shouldn't terminate
 the service worker if it wants that work to complete.

 The `install` events in service workers use
 `waitUntil()` to hold the service worker in
 the `installing` phase until tasks
 complete. If the promise passed to `waitUntil()` rejects, the install is
 considered a failure, and the installing service worker is discarded. This is primarily
 used to ensure that a service worker is not considered installed until all of the core
 caches it depends on are successfully populated.

 The `activate` events in service workers use
 `waitUntil()` to buffer functional events such as `fetch` and
 `push` until the promise passed to `waitUntil()` settles. This
 gives the service worker time to update database schemas and delete outdated
 `caches`, so other events can rely on a completely upgraded state.

 The `waitUntil()` method must be initially called within the event callback,
 but after that it can be called multiple times, until all the promises passed to it
 settle.


**Note:** The behavior described in the above paragraph was fixed in
 Firefox 43 (see Firefox bug 1180274).


Syntax
------


```js
waitUntil(promise)
```

### Parameters

A `Promise`.

### Return value

None (`undefined`).

Examples
--------

Using `waitUntil()` within a service worker's `install` event:


```js
addEventListener("install", (event) => {
  const preCache = async () => {
    const cache = await caches.open("static-v1");
    return cache.addAll(["/", "/about/", "/static/styles.css"]);
  };
  event.waitUntil(preCache());
});
```

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

| Specification |
| --- |
| Service Workers # dom-extendableevent-waituntil |

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

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

See also
--------

* Using Service Workers
ExtendableEvent: ExtendableEvent() constructor
==============================================

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

Syntax
------


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

### Parameters

`type`

A string with the name of the event. It is case-sensitive.

`options` Optional

 An object that, *in addition of the properties defined in `Event()`*, can contain any custom settings
 that you want to apply to the event object.
 Currently no possible options are mandatory,
 but this has been defined for forward compatibility across the different derived events.


### Return value

A new `ExtendableEvent` object.

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

| Specification |
| --- |
| Service Workers # dom-extendableevent-extendableevent |

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

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

See also
--------

* Using Service Workers
* Service workers basic code example
* Using web workers
AudioBuffer: length property
============================

 The **`length`** property of the `AudioBuffer`
 interface returns an integer representing the length, in sample-frames, of the PCM data
 stored in the buffer.

Value
-----

An integer.

Examples
--------


```js
// Stereo
const channels = 2;

// Create an empty two second stereo buffer at the
// sample rate of the AudioContext
const frameCount = audioCtx.sampleRate \* 2.0;
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

button.onclick = () => {
  // Fill the buffer with white noise;
  // just random values between -1.0 and 1.0
  for (let channel = 0; channel < channels; channel++) {
    // This gives us the actual ArrayBuffer that contains the data
    const nowBuffering = myArrayBuffer.getChannelData(channel);
    for (let i = 0; i < frameCount; i++) {
      // Math.random() is in [0; 1.0]
      // audio needs to be in [-1.0; 1.0]
      nowBuffering[i] = Math.random() \* 2 - 1;
    }
  }

  console.log(myArrayBuffer.length);
};
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-length |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: AudioBuffer() constructor
======================================

 The **`AudioBuffer`** constructor of
 the Web Audio API creates a new
 `AudioBuffer` object.

Syntax
------


```js
new AudioBuffer(options)
```

### Parameters

`options`

Options are as follows:

`length`

 The size of the audio buffer in sample-frames. To determine
 the `length` to use for a specific number of seconds of audio, use
 `numSeconds * sampleRate`.


`numberOfChannels`

 The number of channels for the buffer. The
 default is 1, and all user agents are required to support at least 32 channels.


`sampleRate`

 The sample rate in Hz for the buffer. The default is
 the sample rate of the `context` used in constructing this object. User
 agents are required to support sample rates from 8,000 Hz to 96,000 Hz (but are
 allowed to go farther outside this range).


`channelCount`

 Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
 (See `AudioNode.channelCount` for more information.) Its usage and precise
 definition depend on the value of `channelCountMode`.


`channelCountMode`

 Represents an enumerated value describing the way channels must be matched between
 the node's inputs and outputs. (See `AudioNode.channelCountMode` for more
 information including default values.)


`channelInterpretation`

 Represents an enumerated value describing the meaning of the channels. This
 interpretation will define how audio up-mixing and down-mixing will happen.
 The possible values are `"speakers"` or `"discrete"`. (See
 `AudioNode.channelCountMode` for more information including default
 values.)




#### Deprecated parameters

`context` 
Deprecated

 A reference to an `AudioContext`. This parameter was removed from the
 spec.


### Exceptions

`NotSupportedError` `DOMException`

 Thrown if one or more of the options are negative or otherwise has an invalid value
 (such as `numberOfChannels` being higher than supported,
 or a `sampleRate` outside the nominal range).


`RangeError`

Thrown if there isn't enough memory available to allocate the buffer.

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-audiobuffer |

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

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

 The
 **`copyFromChannel()`** method of the
 `AudioBuffer` interface copies the audio sample data from the specified
 channel of the `AudioBuffer` to a specified
 `Float32Array`.

Syntax
------


```js
copyFromChannel(destination, channelNumber, startInChannel)
```

### Parameters

`destination`

A `Float32Array` to copy the channel's samples to.

`channelNumber`

 The channel number of the current `AudioBuffer` to copy the channel data
 from.


`startInChannel` Optional

 An optional offset into the source channel's buffer from which to begin copying
 samples. If not specified, a value of 0 (the beginning of the buffer) is assumed by
 default.


### Return value

None (`undefined`).

### Exceptions

`indexSizeError`

One of the input parameters has a value that is outside the accepted range:

* The value of `channelNumber` specifies a channel number
 which doesn't exist (that is, it's greater than or equal to the value of
 `numberOfChannels` on the channel).
* The value of `startInChannel` is outside the current range
 of samples that already exist in the source buffer; that is, it's greater than its
 current `length`.

Examples
--------

 This example creates a new audio buffer, then copies the samples from another channel
 into it.


```js
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
const anotherArray = new Float32Array(length);
myArrayBuffer.copyFromChannel(anotherArray, 1, 0);
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-copyfromchannel |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: copyToChannel() method
===================================

 The `copyToChannel()` method of the `AudioBuffer` interface copies
 the samples to the specified channel of the `AudioBuffer`, from the source array.

Syntax
------


```js
copyToChannel(source, channelNumber)
copyToChannel(source, channelNumber, startInChannel)
```

### Parameters

`source`

A `Float32Array` that the channel data will be copied from.

`channelNumber`

 The channel number of the current `AudioBuffer` to copy the channel
 data to. If *channelNumber* is greater than or equal to
 `AudioBuffer.numberOfChannels`, an `INDEX_SIZE_ERR` will be
 thrown.


`startInChannel` Optional

 An optional offset to copy the data to. If *startInChannel* is greater than
 `AudioBuffer.length`, an `INDEX_SIZE_ERR` will be thrown.


### Return value

None (`undefined`).

Examples
--------


```js
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);
const anotherArray = new Float32Array();
// Copy channel data from second channel of myArrayBuffer.
myArrayBuffer.copyFromChannel(anotherArray, 1, 0);
// Copy data from anotherArray to first channel of myArrayBuffer. Both channels have the same data now.
myArrayBuffer.copyToChannel(anotherArray, 0, 0);
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-copytochannel |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: getChannelData() method
====================================

The **`getChannelData()`** method of the `AudioBuffer` Interface returns a `Float32Array` containing the PCM data associated with the channel, defined by the channel parameter (with 0 representing the first channel).

Syntax
------


```js
getChannelData(channel)
```

### Parameters

`channel`

The channel property is an index representing the particular channel to get data for. An index value of 0 represents the first channel. If the `channel` index value is greater than of equal to `AudioBuffer.numberOfChannels`, an `INDEX_SIZE_ERR` exception will be thrown.

### Return value

A `Float32Array`.

Examples
--------

In the following example we create a two second buffer, fill it with white noise, and then play it via an `AudioBufferSourceNode`. The comments should clearly explain what is going on. You can also run the code live, or view the source.


```js
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
const button = document.querySelector("button");
const pre = document.querySelector("pre");
const myScript = document.querySelector("script");

pre.innerHTML = myScript.innerHTML;

// Stereo
const channels = 2;
// Create an empty two second stereo buffer at the
// sample rate of the AudioContext
const frameCount = audioCtx.sampleRate \* 2.0;

const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

button.onclick = () => {
  // Fill the buffer with white noise;
  //just random values between -1.0 and 1.0
  for (let channel = 0; channel < channels; channel++) {
    // This gives us the actual ArrayBuffer that contains the data
    const nowBuffering = myArrayBuffer.getChannelData(channel);
    for (let i = 0; i < frameCount; i++) {
      // Math.random() is in [0; 1.0]
      // audio needs to be in [-1.0; 1.0]
      nowBuffering[i] = Math.random() \* 2 - 1;
    }
  }

  // Get an AudioBufferSourceNode.
  // This is the AudioNode to use when we want to play an AudioBuffer
  const source = audioCtx.createBufferSource();
  // set the buffer in the AudioBufferSourceNode
  source.buffer = myArrayBuffer;
  // connect the AudioBufferSourceNode to the
  // destination so we can hear the sound
  source.connect(audioCtx.destination);
  // start the source playing
  source.start();
};
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-getchanneldata |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: sampleRate property
================================

 The **`sampleRate`** property of the `AudioBuffer` interface returns a float representing the sample rate, in
 samples per second, of the PCM data stored in the buffer.

Value
-----

 A floating-point value indicating the current sample rate of the buffers data, in
 samples per second.

Examples
--------


```js
// Stereo
const channels = 2;

// Create an empty two second stereo buffer at the
// sample rate of the AudioContext
const frameCount = audioCtx.sampleRate \* 2.0;
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

button.onclick = () => {
  // Fill the buffer with white noise;
  // just random values between -1.0 and 1.0
  for (let channel = 0; channel < channels; channel++) {
    // This gives us the actual ArrayBuffer that contains the data
    const nowBuffering = myArrayBuffer.getChannelData(channel);
    for (let i = 0; i < frameCount; i++) {
      // Math.random() is in [0; 1.0]
      // audio needs to be in [-1.0; 1.0]
      nowBuffering[i] = Math.random() \* 2 - 1;
    }
  }

  console.log(myArrayBuffer.sampleRate);
};
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-samplerate |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: numberOfChannels property
======================================

 The `numberOfChannels` property of the `AudioBuffer`
 interface returns an integer representing the number of discrete audio channels
 described by the PCM data stored in the buffer.

Value
-----

An integer.

Examples
--------


```js
// Stereo
const channels = 2;

// Create an empty two second stereo buffer at the
// sample rate of the AudioContext
const frameCount = audioCtx.sampleRate \* 2.0;
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

button.onclick = () => {
  // Fill the buffer with white noise;
  // just random values between -1.0 and 1.0
  for (let channel = 0; channel < channels; channel++) {
    // This gives us the actual ArrayBuffer that contains the data
    const nowBuffering = myArrayBuffer.getChannelData(channel);
    for (let i = 0; i < frameCount; i++) {
      // Math.random() is in [0; 1.0]
      // audio needs to be in [-1.0; 1.0]
      nowBuffering[i] = Math.random() \* 2 - 1;
    }
  }

  console.log(myArrayBuffer.numberOfChannels);
};
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-numberofchannels |

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

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

See also
--------

* Using the Web Audio API
AudioBuffer: duration property
==============================

 The **`duration`** property of the `AudioBuffer` interface returns a double representing the duration, in seconds, of the PCM data
 stored in the buffer.

Value
-----

A double.

Examples
--------


```js
// Stereo
const channels = 2;

// Create an empty two second stereo buffer at the
// sample rate of the AudioContext
const frameCount = audioCtx.sampleRate \* 2.0;
const myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);

button.onclick = () => {
  // Fill the buffer with white noise;
  // just random values between -1.0 and 1.0
  for (let channel = 0; channel < channels; channel++) {
    // This gives us the actual ArrayBuffer that contains the data
    const nowBuffering = myArrayBuffer.getChannelData(channel);
    for (let i = 0; i < frameCount; i++) {
      // Math.random() is in [0; 1.0]
      // audio needs to be in [-1.0; 1.0]
      nowBuffering[i] = Math.random() \* 2 - 1;
    }
  }

  console.log(myArrayBuffer.duration);
};
```

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

| Specification |
| --- |
| Web Audio API # dom-audiobuffer-duration |

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

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

See also
--------

* Using the Web Audio API