From 7c33835b8acd612818553d167594cf8162379144 Mon Sep 17 00:00:00 2001 From: moorgar11 Date: Tue, 11 Mar 2014 09:24:07 +0100 Subject: [PATCH] test --- index.html | 10 ++++++++++ lock.js | 6 ++---- main.js | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 index.html create mode 100644 main.js 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;