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/08/01 18:39:08 UTC
[3/48] git commit: [app] Update the JavaScript comments.
[app] Update the JavaScript comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/commit/133aae31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/tree/133aae31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/diff/133aae31
Branch: refs/heads/master
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-app-hello-world/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('');