Created
August 11, 2009 17:26
-
-
Save shazron/165974 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function watchCompass() { | |
| debug.log("watchCompass"); | |
| var suc = function(a){ | |
| document.getElementById('compass_magnetic').innerHTML = roundNumber(a.magneticHeading); | |
| document.getElementById('compass_true').innerHTML = roundNumber(a.trueHeading); | |
| document.getElementById('compass_accuracy').innerHTML = roundNumber(a.headingAccuracy); | |
| }; | |
| var fail = function(){}; | |
| var opt = {}; | |
| opt.frequency = 100; | |
| timer = navigator.compass.watchHeading(suc,fail,opt); | |
| } | |
| /* HTML test code | |
| <dl id="compass-data"> | |
| <dt>M:</dt><dd id="compass_magnetic"> </dd> | |
| <dt>T:</dt><dd id="compass_true"> </dd> | |
| <dt>A:</dt><dd id="compass_accuracy"> </dd> | |
| </dl> | |
| <a href="#" class="btn large" onclick="watchCompass();">Watch Compass</a> | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment