recursal/MDN huggingface dataset:
Window: screenLeft property
===========================

 The **`Window.screenLeft`** read-only property returns the
 horizontal distance, in CSS pixels, from the left border of the user's browser viewport
 to the left side of the screen.


**Note:** `screenLeft` is an alias of the older
 `Window.screenX` property. `screenLeft` was originally
 supported only in IE but was introduced everywhere due to popularity.


Value
-----

 A number equal to the number of CSS pixels from the left edge of the browser viewport
 to the left edge of the screen.

Examples
--------

 In our screenleft-screentop
 example, you'll see a canvas onto which has been drawn a circle. In this example we are
 using `screenLeft`/`screenTop` plus
 `Window.requestAnimationFrame()` to constantly redraw the circle in the
 same physical position on the screen, even if the window position is moved.


```js
initialLeft = window.screenLeft + canvasElem.offsetLeft;
initialTop = window.screenTop + canvasElem.offsetTop;

function positionElem() {
  let newLeft = window.screenLeft + canvasElem.offsetLeft;
  let newTop = window.screenTop + canvasElem.offsetTop;

  let leftUpdate = initialLeft - newLeft;
  let topUpdate = initialTop - newTop;

  ctx.fillStyle = "rgb(0 0 0)";
  ctx.fillRect(0, 0, width, height);
  ctx.fillStyle = "rgb(0 0 255)";
  ctx.beginPath();
  ctx.arc(
    leftUpdate + width / 2,
    topUpdate + height / 2 + 35,
    50,
    degToRad(0),
    degToRad(360),
    false,
  );
  ctx.fill();

  pElem.textContent = `Window.screenLeft: ${window.screenLeft}, Window.screenTop: ${window.screenTop}`;

  window.requestAnimationFrame(positionElem);
}

window.requestAnimationFrame(positionElem);
```


 Also in the code we include a snippet that detects whether `screenLeft` is
 supported, and if not, polyfills in `screenLeft`/`screenTop` using
 `Window.screenX`/`Window.screenY`.


```js
if (!window.screenLeft) {
  window.screenLeft = window.screenX;
  window.screenTop = window.screenY;
}
```

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

| Specification |
| --- |
| CSSOM View Module # dom-window-screenleft |

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

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

See also
--------

* `window.screenTop`
* `Window.screenX`
Window: window property
=======================

The **`window`** property of a `Window` object points to the window object itself.

Thus, the following expressions all return the same window object:


```js
window.window;
window.window.window;
window.window.window.window;
// …
```


In web pages, the window object is also a *global object*. This means:

1. Global variables of your script are, in fact, properties of `window`:

```js
var global = { data: 0 };
alert(global === window.global); // displays "true"
```

2. You can access the built-in properties of the window object without having to prefix them with `window.`:

```js
setTimeout("alert('Hi!')", 50); // equivalent to using window.setTimeout().
alert(window === window.window); // displays "true"
```


The point of having the `window` property refer to the object itself, was likely to make it easy to refer to the global object. Otherwise, you'd have to do a manual `let window = this;` assignment at the top of your script.

Another reason, is that without this property you wouldn't be able to write, for example, "`window.open('https://google.com/')`". You'd have to use `open('https://google.com/')` instead.

Yet another reason to use this property, is for libraries which wish to offer OOP-versions, and non-OOP versions (especially JavaScript modules). For example, if we refer to "this.window.location.href", a JavaScript module could define a property called "window" inside of a class it defined (since no global "window" variable exists for it by default) which could be created after passing in a window object to the module class' constructor. Thus, "this.window" inside of its functions would refer to that window object. In the non-namespaced version, "this.window" would refer back to "window", and also be able to readily get the document location. Another advantage, is that the objects of such a class (even if the class were defined outside of a module) could change their reference to the window at will, they would not be able to do this if they had hard-coded a reference to "window". The default in the class could still be set as the current window object.

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

| Specification |
| --- |
| HTML Standard # dom-window-dev |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Window: captureEvents() 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 **`Window.captureEvents()`** method does nothing.

**Note:** This is an method long removed from the specification. It is kept in browsers to prevent code breakage but does nothing.

Syntax
------


```js
captureEvents()
```

### Parameters

None.

### Return value

None (`undefined`).

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

| Specification |
| --- |
| HTML Standard # dom-window-captureevents |

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

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

**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 `mozInnerScreenY` property of the `Window` interface returns the Y coordinate of the top-left corner of the window's viewport, in screen
 coordinates.

**Note:** This coordinate is reported in CSS pixels, not in hardware pixels.

Value
-----

The `window.mozInnerScreenY` property is a floating point, read-only value; it has no default value.

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

This feature is not part of any current specification. It is not on track to become a standard.

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

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

See also
--------

* `window.mozInnerScreenX`
Window: deviceorientationabsolute event
=======================================

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

The **`deviceorientationabsolute`** event is fired when absolute device orientation changes.

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("deviceorientationabsolute", (event) => {});

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

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

A `DeviceOrientationEvent`. Inherits from `Event`.

Event

DeviceOrientationEventEvent properties
----------------

`DeviceOrientationEvent.absolute` Read only 

A boolean that indicates whether the device is providing orientation data absolutely.

`DeviceOrientationEvent.alpha` Read only 

A number representing the motion of the device around the z axis, expressed in degrees with values ranging from 0 (inclusive) to 360 (exclusive).

`DeviceOrientationEvent.beta` Read only 

A number representing the motion of the device around the x axis, expressed in degrees with values ranging from -180 (inclusive) to 180 (exclusive). This represents a front to back motion of the device.

`DeviceOrientationEvent.gamma` Read only 

A number representing the motion of the device around the y axis, expressed in degrees with values ranging from -90 (inclusive) to 90 (exclusive). This represents a left to right motion of the device.

`DeviceOrientationEvent.webkitCompassHeading` 
Non-standard
 Read only 

A number represents the difference between the motion of the device around the z axis of the world system and the direction of north, expressed in degrees with values ranging from 0 to 360.

`DeviceOrientationEvent.webkitCompassAccuracy` 
Non-standard
 Read only 

The accuracy of the compass given as a positive or negative deviation. It's usually 10.

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

| Specification |
| --- |
| DeviceOrientation Event Specification # dom-window-ondeviceorientationabsolute |

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

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

See also
--------

* `devicemotion` event
* `deviceorientation` event
* Detecting device orientation
Window: scrollByPages() 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 **`Window.scrollByPages()`** method scrolls the current
 document by the specified number of pages.

Syntax
------


```js
scrollByPages(pages)
```

### Parameters

* `pages` is the number of pages to scroll. It may be a positive or
 negative integer.
### Return value

None (`undefined`).

Examples
--------


```js
// scroll down the document by 1 page
window.scrollByPages(1);

// scroll up the document by 1 page
window.scrollByPages(-1);
```

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

DOM Level 0. Not part of specification.

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

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

See also
--------

* `window.scroll()`
* `window.scrollBy()`
* `window.scrollByLines()`
* `window.scrollTo()`
Sensor: activated property
==========================

 The **`activated`** read-only property
 of the `Sensor` interface returns a boolean value indicating
 whether the sensor is active.

 Because `Sensor` is a base class, `activated` may only be read
 from one of its derived classes.

Value
-----

A boolean value.

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

| Specification |
| --- |
| Generic Sensor API # sensor-activated |

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

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

 The **`start`** method activates one
 of the sensors based on `Sensor`.

Syntax
------


```js
start()
```

### Parameters

None.

### Return value

None (`undefined`).

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

| Specification |
| --- |
| Generic Sensor API # sensor-start |

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

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

 The **`hasReading`** read-only
 property of the `Sensor` interface returns a boolean value
 indicating whether the sensor has a reading.

 Because `Sensor` is a base class, `hasReading` may only be read
 from one of its derived classes.

Value
-----

A boolean value.

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

| Specification |
| --- |
| Generic Sensor API # sensor-has-reading |

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

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

The **`reading`** event is fired when a new reading is available on a sensor.

 The `Sensor` interface is a base class, `onreading` and the `reading` event may only be used
 on one of the derived classes.

Syntax
------

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


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

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

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

A generic `Event` with no added properties.

Examples
--------

### Reading acceleration

This example adds an event listener to read acceleration values of an `Accelerometer`. It reads sixty times a second.


```js
const acl = new Accelerometer({ frequency: 60 });
acl.addEventListener("reading", () => {
  console.log(`Acceleration along the X-axis ${acl.x}`);
  console.log(`Acceleration along the Y-axis ${acl.y}`);
  console.log(`Acceleration along the Z-axis ${acl.z}`);
});
acl.start();
```

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

| Specification |
| --- |
| Generic Sensor API # sensor-onreading |

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

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

See also
--------

* Sensor `activate` event
* Sensor `error` event
Sensor: timestamp property
==========================

 The **`timestamp`** read-only property
 of the `Sensor` interface returns the timestamp of the latest sensor
 reading.

 Because `Sensor` is a base class, `timestamp` may only be read
 from one of its derived classes.

Value
-----

A `DOMHighResTimeStamp`.

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

| Specification |
| --- |
| Generic Sensor API # sensor-timestamp |

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

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

 The **`stop`** method of the
 `Sensor` interface deactivates the current sensor.

Syntax
------


```js
stop()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------


```js
// TBD
```

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

| Specification |
| --- |
| Generic Sensor API # sensor-stop |

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

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

The **`activate`** event is fired when a sensor becomes activated. It means that it will start obtaining readings.

 The `Sensor` interface is a base class, `onactivate` and the `activate` event may only be used
 on one of the derived classes.

Syntax
------

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


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

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

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

A generic `Event` with no added properties.

Examples
--------

### Log when an accelerometer is ready to measure

This example adds an event listener to log the activation of an `Accelerometer`.


```js
const acl = new Accelerometer({ frequency: 60 });
acl.addEventListener("activate", () => console.log("Ready to measure."));
acl.start();
```

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

| Specification |
| --- |
| Generic Sensor API # sensor-onactivate |

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

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

See also
--------

* Sensor `error` event
* Sensor `reading` event
Sensor: error event
===================

The **`error`** event is fired when an exception occurs on a sensor.

 The `Sensor` interface is a base class, `onerror` and the `error` event may only be used
 on one of the derived classes.

After this event has occurred, the `Sensor` object becomes idle. If the sensor was reading values, it will stop until it restarts.

Syntax
------

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


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

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

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

A `SensorErrorEvent`. Inherits from `Event`.

Event

SensorErrorEventEvent properties
----------------

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

`error` Read only 

Returns the `DOMException` that has been thrown.

Examples
--------

### Log accelerometer exceptions

This example adds an event listener to log errors occurred on an `Accelerometer`.


```js
const acl = new Accelerometer({ frequency: 60 });
acl.addEventListener("error", (error) => console.log(`Error: ${error.name}`));
acl.start();
```

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

| Specification |
| --- |
| Generic Sensor API # sensor-onerror |

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

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

See also
--------

* Sensor `activate` event
* Sensor `reading` event
VRFrameData: leftProjectionMatrix 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 **`leftProjectionMatrix`** read-only property of the `VRFrameData` interface returns a `Float32Array` representing a 4x4 matrix that describes the projection to be used for the left eye's rendering.

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

This value may be passed directly to WebGL's `uniformMatrix4fv` function.

**Warning:** It is highly recommended that applications use this matrix without modification. Failure to use this projection matrix when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort.

Value
-----

A `Float32Array` object.

Examples
--------

See `VRDisplay.getFrameData()` for example code.

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
VRFrameData: timestamp 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 **`timestamp`** read-only property of the `VRFrameData` interface returns a constantly increasing timestamp value representing the time a frame update occurred.

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

Timestamps are useful for determining if position state data has been updated from the hardware. Since values are monotonically increasing, they can be compared to determine the ordering of updates — newer values will always be greater than or equal to older values.

The timestamp starts at 0 the first time `VRDisplay.getFrameData()` is invoked for a given `VRDisplay`.

Value
-----

A `DOMHighResTimeStamp` object.

Examples
--------


```js
const frameData = new VRFrameData();
let vrDisplay;

navigator.getVRDisplays().then((displays) => {
  vrDisplay = displays[0];
  console.log("Display found");
  // Starting the presentation when the button is clicked: It can only be called in response to a user gesture
  btn.addEventListener("click", () => {
    vrDisplay.requestPresent([{ source: canvas }]).then(() => {
      drawVRScene();
    });
  });
});

// WebVR: Draw the scene for the WebVR display.
function drawVRScene() {
  // WebVR: Request the next frame of the animation
  vrSceneFrame = vrDisplay.requestAnimationFrame(drawVRScene);

  // Populate frameData with the data of the next frame to display
  vrDisplay.getFrameData(frameData);

  // grab the current timestamp on each run of the rendering loop
  // and do something with it
  framedata.timestamp;

  // …

  // WebVR: Indicates that we are ready to present the rendered frame to the VR display
  vrDisplay.submitFrame();
}
```

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
VRFrameData: leftViewMatrix 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 **`leftViewMatrix`** read-only property of the `VRFrameData` interface returns a `Float32Array` representing a 4x4 matrix that describes the view transform to be used for the left eye's rendering.

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

This value may be passed directly to WebGL's `uniformMatrix4fv` function.

**Warning:** It is highly recommended that applications use this matrix when rendering.

Value
-----

A `Float32Array` object.

Examples
--------

See `VRDisplay.getFrameData()` for example code.

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