initDeviceMotionEvent method
Used to create a DeviceMotionEvent event from JavaScript.
createEvent()/initEvent() constructor pattern for synthetic events is deprecated. See the Synthetic Events page for more information.![]() |
Syntax
var retval = DeviceMotionEvent.initDeviceMotionEvent(type, canBubble, cancelable, acceleration, accelerationIncludingGravity, rotationRate, interval);Parameters
- type [in]
-
Type: DOMString
The type of the event being created
- canBubble [in]
-
Type: boolean
Indicates whether the event can bubble. When true the event should propagate upward. When false the event does not propagate upward.
- cancelable [in]
-
Type: boolean
Indicates whether the event’s default action can be prevented. When true, the default action can be canceled. When false, the default action cannot be canceled.
- acceleration [in]
-
Type: DeviceAcceleration
Represents the acceleration (in m/s²) of the host device in motion along the X, Y, and Z axes.
- accelerationIncludingGravity [in]
-
Type: DeviceAcceleration
Represents the acceleration (in m/s²), including the effect of gravity, of the host device in motion along the X, Y, and Z axes.
- rotationRate [in]
-
Type: DeviceRotationRate
Represents the rate of rotation (in deg/s) of the host device in space, around its X, Y, and Z axes.
- interval [in]
-
Type: double
Represents the interval (in milliseconds) at which motion data is being obtained from the underlying hardware of the host device.
Return value
Type: HRESULT
This method can return one of these values.
- S_OK
Standards information
See also
