You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2012/07/27 20:55:00 UTC

[3/4] git commit: [app] Update the JavaScript comments.

[app] Update the JavaScript comments.


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/133aae31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/133aae31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/133aae31

Branch: refs/heads/hello-cordova
Commit: 133aae3175589c67b2c40f5c0fc521e45d969b9d
Parents: 9dab5b9
Author: Michael Brooks <mi...@michaelbrooks.ca>
Authored: Fri Jul 27 10:54:23 2012 -0700
Committer: Michael Brooks <mi...@michaelbrooks.ca>
Committed: Fri Jul 27 10:54:23 2012 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/133aae31/www/js/index.js
----------------------------------------------------------------------
diff --git a/www/js/index.js b/www/js/index.js
index b7d0286..cac978a 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -6,13 +6,17 @@ var app = {
         document.addEventListener('deviceready', this.deviceready, false);
     },
     deviceready: function() {
-        // 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()
+        // This is an event handler function, which means the scope is the event.
+        // So, we must explicitly called `app.report()` instead of `this.report()`.
         app.report('deviceready');
     },
     report: function(id) {
-        console.log("report:" + id);
-        // hide the .pending <p> and show the .complete <p>
+        // Report the event in the console
+        console.log("Report: " + id);
+
+        // Toggle the state from "pending" to "complete" for the reported ID.
+        // Accomplished by adding .hide to the pending element and removing
+        // .hide from the complete element.
         document.querySelector('#' + id + ' .pending').className += ' hide';
         var completeElem = document.querySelector('#' + id + ' .complete');
         completeElem.className = completeElem.className.split('hide').join('');