Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 97351 of nsIDOMOrientationEvent

  • Revision slug: XPCOM_Interface_Reference/nsIDOMOrientationEvent
  • Revision title: nsIDOMOrientationEvent
  • Revision id: 97351
  • Created:
  • Creator: fryn
  • Is current revision? No
  • Comment 1 words added, 3 words removed

Revision Content

{{ gecko_minversion_header("1.9.2") }}

The nsIDOMOrientationEvent interface describes the event that can be delivered to DOM windows, providing information from the device's accelerometer, allowing code to determine the orientation of the device.

{{ InterfaceStatus("nsIDOMOrientationEvent", "dom/interfaces/events/nsIDOMOrientationEvent.idl", "unfrozen", "Mozilla 1.9.2", "yes") }}

Inherits from: {{ Interface("nsIDOMEvent") }}

Method overview

void initOrientationEvent(in DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg,
                          in double x, in double y,
in double z);

Attributes

Attribute Type Description
x double The amount of tilt along the X axis.  Read only.
y

double

The amount of tilt along the Y axis.  Read only.
z double The amount of tilt along the Z axis.  Read only.

The values of x, y, and z can range from -1 to 1, where 0 means the device is balanced on that axis. See Accelerometer values explained for details.

Methods

initOrientationEvent()

Initializes the orientation event object.

void initProgressEvent(
  in DOMString eventTypeArg,
  in boolean canBubbleArg,
  in boolean cancelableArg,
  in double x,
  in double y,
  in double z
);
Parameters
eventTypeArg
The type of event. Must be "MozOrientation".
canBubbleArg
Specifies whether or not the created event will bubble.
cancelableArg
Specifies whether or not the created event can be canceled.
x
The amount of tilt along the X axis.
y
The amount of tilt along the Y axis.
z
The amount of tilt along the Z axis.

See also

  • MozOrientation
  • {{ interface("nsIAcceleration") }}
  • {{ interface("nsIAccelerationListener") }}
  • {{ interface("nsIAccelerometer") }}

Revision Source

<p>{{ gecko_minversion_header("1.9.2") }}</p>
<p>The <code>nsIDOMOrientationEvent</code> interface describes the event that can be delivered to DOM windows, providing information from the device's accelerometer, allowing code to determine the orientation of the device.</p>
<p>{{ InterfaceStatus("nsIDOMOrientationEvent", "dom/interfaces/events/nsIDOMOrientationEvent.idl", "unfrozen", "Mozilla 1.9.2", "yes") }}</p>
<p>Inherits from: {{ Interface("nsIDOMEvent") }}</p>
<h2 id="Attributes" name="Attributes">Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>void initOrientationEvent(in DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg,<br>                           in double x, in double y,</code> <code>in double z);</code></td> </tr> </tbody>
</table>
<h2 id="Attributes">Attributes</h2>
<table class="standard-table"> <tbody> <tr> <td class="header">Attribute</td> <td class="header">Type</td> <td class="header">Description</td> </tr> <tr> <td><code>x</code></td> <td><code>double</code></td> <td>The amount of tilt along the X axis.  <strong>Read only</strong>.</td> </tr> <tr> <td><code>y</code></td> <td> <p><code>double</code></p> </td> <td>The amount of tilt along the Y axis.  <strong>Read only</strong>.</td> </tr> <tr> <td><code>z</code></td> <td><code>double</code></td> <td>The amount of tilt along the Z axis.  <strong>Read only</strong>.</td> </tr> </tbody>
</table>
<p>The values of <code>x</code>, <code>y</code>, and <code>z</code> can range from -1 to 1, where 0 means the device is balanced on that axis. See <a href="/en/Detecting_device_orientation#Accelerometer_values_explained" title="en/Detecting device orientation#Accelerometer values explained">Accelerometer values explained</a> for details.</p>
<h2 id="Methods">Methods</h2>
<h3 id="initOrientationEvent()">initOrientationEvent()</h3>
<p>Initializes the orientation event object.</p>
<pre>void initProgressEvent(
  in DOMString eventTypeArg,
  in boolean canBubbleArg,
  in boolean cancelableArg,
  in double x,
  in double y,
  in double z
);
</pre>
<h6 id="Parameters">Parameters</h6>
<dl> <dt><code>eventTypeArg</code></dt> <dd>The type of event. Must be "<code>MozOrientation</code>".</dd> <dt><code>canBubbleArg</code></dt> <dd>Specifies whether or not the created event will bubble.</dd> <dt><code>cancelableArg</code></dt> <dd>Specifies whether or not the created event can be canceled.</dd> <dt><code>x</code></dt> <dd>The amount of tilt along the X axis.</dd> <dt><code>y</code></dt> <dd>The amount of tilt along the Y axis.</dd> <dt><code>z</code></dt> <dd>The amount of tilt along the Z axis.</dd>
</dl>
<h2 id="See_also">See also</h2>
<ul> <li><a href="/en/DOM/MozOrientation" title="en/DOM/MozOrientation"><code>MozOrientation</code></a></li> <li>{{ interface("nsIAcceleration") }}</li> <li>{{ interface("nsIAccelerationListener") }}</li> <li>{{ interface("nsIAccelerometer") }}</li>
</ul>
Revert to this revision