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/30 20:13:04 UTC
[3/3] git commit: [app] Refactor JavaScript names for clarity.
[app] Refactor JavaScript names for clarity.
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/7e8ddbca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/tree/7e8ddbca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/diff/7e8ddbca
Branch: refs/heads/master
Commit: 7e8ddbca2324b5e37326fa406df5fb78b50aa3ab
Parents: 2e929c0
Author: Michael Brooks <mi...@michaelbrooks.ca>
Authored: Tue Aug 28 16:38:55 2012 -0700
Committer: Michael Brooks <mi...@michaelbrooks.ca>
Committed: Tue Aug 28 16:38:55 2012 -0700
----------------------------------------------------------------------
www/js/index.js | 8 ++++----
www/spec/index.js | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/blob/7e8ddbca/www/js/index.js
----------------------------------------------------------------------
diff --git a/www/js/index.js b/www/js/index.js
index 7223130..e62b652 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -18,12 +18,12 @@
*/
var app = {
initialize: function() {
- this.bind();
+ this.bindEvents();
},
- bind: function() {
- document.addEventListener('deviceready', this.deviceready, false);
+ bindEvents: function() {
+ document.addEventListener('deviceready', this.onDeviceReady, false);
},
- deviceready: function() {
+ onDeviceReady: function() {
// 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');
http://git-wip-us.apache.org/repos/asf/incubator-cordova-app-hello-world/blob/7e8ddbca/www/spec/index.js
----------------------------------------------------------------------
diff --git a/www/spec/index.js b/www/spec/index.js
index b43fefa..3693d6b 100644
--- a/www/spec/index.js
+++ b/www/spec/index.js
@@ -20,25 +20,25 @@ describe('app', function() {
describe('initialize', function() {
it('should bind deviceready', function() {
runs(function() {
- spyOn(app, 'deviceready');
+ spyOn(app, 'onDeviceReady');
app.initialize();
helper.trigger(window.document, 'deviceready');
});
waitsFor(function() {
- return (app.deviceready.calls.length > 0);
- }, 'deviceready should be called once', 500);
+ return (app.onDeviceReady.calls.length > 0);
+ }, 'onDeviceReady should be called once', 500);
runs(function() {
- expect(app.deviceready).toHaveBeenCalled();
+ expect(app.onDeviceReady).toHaveBeenCalled();
});
});
});
- describe('deviceready', function() {
+ describe('onDeviceReady', function() {
it('should report that it fired', function() {
spyOn(app, 'report');
- app.deviceready();
+ app.onDeviceReady();
expect(app.report).toHaveBeenCalledWith('deviceready');
});
});