Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of 'deviceorientation' events in Firefox give warning

When running the following code in Firefox 60 console give me a warning message:

"Use of the orientation sensor is deprecated."

window.addEventListener('deviceorientation', function(event) {
  console.log(event.alpha + ' : ' + event.beta + ' : ' + event.gamma);
});

Tried this on Windows and Mac on Firefox 60 and 61(Beta). The warning shows up and it happens for Firefox only.

Looked at few places like release notes for Firefox 60 (https://www.mozilla.org/en-US/firefox/60.0/releasenotes/) and the security issues fixed (https://www.mozilla.org/en-US/security/advisories/mfsa2018-11/). Did not see anything being changed for device orientation and additional warning.

My question:

  1. What would be the reason to show the warning.
  2. Is there a timeline when the support for adding this event listener will be completely stopped and browser will start showing error.

Any help is greatly appreciated.

like image 323
iamak Avatar asked Jun 30 '18 00:06

iamak


1 Answers

Firefox interprets errors and javascript in a much more strict fashion than other browsers. You are bound to get many more warnings than you would in a different browser. The best place to find information about these warning is on MDN. As for the timeline, I'm not aware of any place to find it.

I took a look at the MDN on the subject (here) and didn't see anything about it being depreciated. Your actual code looks good though from what I can see.

like image 80
sylphaxiom Avatar answered Nov 20 '22 06:11

sylphaxiom