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
[6/48] 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.
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-app-hello-world/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/commit/a62b502c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/tree/a62b502c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/diff/a62b502c
Branch: refs/heads/master
Commit: a62b502c869c61807684afbe76a7885e95306baa
Parents: f8ae936
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jul 18 17:21:17 2012 -0700
Committer: Jesse MacFadyen <pu...@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-app-hello-world/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('');
}
};