Info: Compass.js allows you to get compass heading in JavaScript. Today we haven’t any standard way to get compass data, but there are two proprietary APIs and one hack:
- PhoneGap has navigator.compass API.
- iOS Safari adds webkitCompassHeading property to deviceorientation event.
- We can enable GPS and ask user to go forward. GPS will send current heading, so we can calculate difference between real North and zero in deviceorientation event. Next we use this difference to get compass heading only by device orientation.
This library hides all this magic and APIs from you, auto-detects available way and provides clean and simple API for your geolocation web app.
Info: Compass.js allows you to get compass heading in JavaScript. Today we haven’t any standard way to get compass data, but there are two proprietary APIs and one hack:
- PhoneGap has navigator.compass API.
- iOS Safari adds webkitCompassHeading property to deviceorientation event.
- We can enable GPS and ask user to go forward. GPS will send current heading, so we can calculate difference between real North and zero in deviceorientation event. Next we use this difference to get compass heading only by device orientation.
This library hides all this magic and APIs from you, auto-detects available way and provides clean and simple API for your geolocation web app.