Skip to content

Commit

Permalink
cordova.require("cordova") is pretty funny. wish i didnt write it
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Mar 9, 2012
1 parent b429286 commit 4b05ead
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions framework/src/org/apache/cordova/DroidGap.java
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {

// If back key is bound, then send event to JavaScript
if (this.bound) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('backbutton');");
this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
return true;
}

Expand All @@ -1090,13 +1090,13 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {

// If menu key
else if (keyCode == KeyEvent.KEYCODE_MENU) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('menubutton');");
this.appView.loadUrl("javascript:cordova.fireDocumentEvent('menubutton');");
return super.onKeyDown(keyCode, event);
}

// If search key
else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('searchbutton');");
this.appView.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');");
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ else if(screenHeight == width)
// gone away.
else if (height > oldHeight) {
if(app != null)
app.sendJavascript("cordova.require('cordova').fireDocumentEvent('hidekeyboard');");
app.sendJavascript("cordova.fireDocumentEvent('hidekeyboard');");
}
// If the height as gotten smaller then we will assume the soft keyboard has
// been displayed.
else if (height < oldHeight) {
if(app != null)
app.sendJavascript("cordova.require('cordova').fireDocumentEvent('showkeyboard');");
app.sendJavascript("cordova.fireDocumentEvent('showkeyboard');");
}

// Update the old height for the next event
Expand Down
4 changes: 2 additions & 2 deletions framework/src/org/apache/cordova/api/PluginResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public String getJSONString() {
}

public String toSuccessCallbackString(String callbackId) {
return "cordova.require('cordova').callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
return "cordova.callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
}

public String toErrorCallbackString(String callbackId) {
return "cordova.require('cordova').callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
return "cordova.callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
}

public static String[] StatusMessages = new String[] {
Expand Down

0 comments on commit 4b05ead

Please sign in to comment.