diff --git a/index.html b/index.html new file mode 100644 index 0000000..eb40694 --- /dev/null +++ b/index.html @@ -0,0 +1,10 @@ + + +
+ + + + + + + \ No newline at end of file diff --git a/lock.js b/lock.js index deecf58..c45cad1 100644 --- a/lock.js +++ b/lock.js @@ -1,5 +1,5 @@ var context; - var main = function () { +var lockinit = function () { var canvas = document.getElementById("canvas"); context = canvas.getContext('2d'); drawLock(); @@ -47,6 +47,4 @@ var drawDial = function(rot) { context.fill(); } context.restore(); -} - -window.onload = main; \ No newline at end of file +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..035297c --- /dev/null +++ b/main.js @@ -0,0 +1,14 @@ +var onSucess = function(heading) { + var element = document.getElementById('heading'); + element.innerHTML = 'Heading: ' + heading; +}; + +var onErrors = function() { + alert('onError!'); +}; + +var startup = function(){ + var watchID = navigator.compass.watchHeading(onSuccess, onErrors); + lockinit(); +} +window.onload = startup;