The historical migration
Vishal Mishra’s 2017 article discussed replacing the Cordova compass plugin with browser orientation events. It compared the plugin’s heading watcher and cleanup method with registering and removing a deviceorientation listener. The browser event exposes orientation angles through alpha, beta and gamma.
Read the original article and its examples. This is an editorial summary of that historical guidance.
Read the specification before adapting old examples
The newer W3C Device Orientation and Motion specification distinguishes relative from absolute orientation. An angle is not automatically a magnetic compass heading in every device position or reference frame. The specification also addresses secure contexts and permissions. Those differences matter when adapting an old example; the 2017 article should not be treated as a guarantee of present browser behavior.
Related material
Sources & archive notes
Recovered repository material is attributed to its original authors and distributed with its source license. Changes: FreeSoft layout, archive context, navigation, link and image locations. Apache License 2.0 · Notices and provenance. Editorial material is labeled separately.