function watchDeviceOrientation() {
	if (hasDeviceOrientation && !deviceOrientationInitialized) {
		if (typeof DeviceOrientationEvent.requestPermission === "function") {
			DeviceOrientationEvent.requestPermission()
				.then((response) => {
					if (response === "granted") {
						globalThis.addEventListener(
							"deviceorientation",
							onDeviceRotate,
							false,
						);
						deviceOrientationInitialized = true;
					}
				})
				.catch(console.error);
		} else {
			globalThis.addEventListener("deviceorientation", onDeviceRotate, false);
			deviceOrientationInitialized = true;
		}
	}
	return deviceOrientationInitialized;
}
Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
(one some device a first user gesture will be required before calling this function)
@memberof device
@see device.alpha
@see device.beta
@see device.gamma
@returns {boolean} false if not supported or permission not granted by the user
@example
// try to enable device orientation event on user gesture
me.input.registerPointerEvent("pointerleave", me.game.viewport, function() {
    if (me.device.watchDeviceOrientation() === true) {
        // Success
        me.input.releasePointerEvent("pointerleave", me.game.viewport);
    } else {
        // ... fail at enabling the device orientation event
    }
});