my.offDeviceMotionChange

Stop listening for device orientation change events.

Parameters

Type

Required

Description

Function listener

Yes

The listener function that is passed to my.onDeviceMotionChange. If this parameter is not specified, all my.onDeviceMotionChange listeners are removed.

Sample Code

Remove a specific listener

copy
//Define the listener function.
var listener = function (res) {
    console.log(res.alpha);
    console.log(res.beta);
    console.log(res.gamma);
}

//Listen for the device orientation change event.
my.onDeviceMotionChange(this.listener);

//Remove the listener.
my.offDeviceMotionChange(this.listener)

Remove all listeners

copy
my.offDeviceMotionChange()