incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject git commit: added back the bind/report methods so the tests will pass again. Added some comments, as that is probably something we should encourage.
Date Thu, 19 Jul 2012 00:22:21 GMT
Updated Branches:
  refs/heads/hello-cordova f8ae936fe -> a62b502c8


added back the bind/report methods so the tests will pass again.  Added some comments, as
that is probably something we should encourage.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/a62b502c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/a62b502c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/a62b502c

Branch: refs/heads/hello-cordova
Commit: a62b502c869c61807684afbe76a7885e95306baa
Parents: f8ae936
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Wed Jul 18 17:21:17 2012 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Wed Jul 18 17:21:17 2012 -0700

----------------------------------------------------------------------
 www/js/index.js |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/a62b502c/www/js/index.js
----------------------------------------------------------------------
diff --git a/www/js/index.js b/www/js/index.js
index bd37862..6140331 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -1,10 +1,20 @@
 var app = {
     initialize: function() {
+        this.bind();
+    },
+    bind: function() {
         document.addEventListener('deviceready', this.deviceready, false);
     },
     deviceready: function() {
-        document.querySelector('#deviceready .pending').className += ' hide';
-        var completeElem = document.querySelector('#deviceready .complete');
+        // note that this is an event handler so the scope is that of the event
+        // so we need to call app.report(), and not this.report()
+        app.report('deviceready');
+    },
+    report: function(id) { 
+        console.log("report:" + id);
+        // hide the .pending <p> and show the .complete <p>
+        document.querySelector('#' + id + ' .pending').className += ' hide';
+        var completeElem = document.querySelector('#' + id + ' .complete');
         completeElem.className = completeElem.className.split('hide').join('');
     }
 };


Mime
View raw message