diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 9e98ac6f..bb51a7a9 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -557,10 +557,25 @@ public class CordovaWebView extends WebView { /** * Send JavaScript statement back to JavaScript. - * (This is a convenience method) - * - * @param statement + * Deprecated (https://issues.apache.org/jira/browse/CB-6851) + * Instead of executing snippets of JS, you should use the exec bridge + * to create a Java->JS communication channel. + * To do this: + * 1. Within plugin.xml (to have your JS run before deviceready): + * + * 2. Within your .js (call exec on start-up): + * require('cordova/channel').onCordovaReady.subscribe(function() { + * require('cordova/exec')(win, null, 'Plugin', 'method', []); + * function win(message) { + * ... process message from java here ... + * } + * }); + * 3. Within your .java: + * PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE); + * dataResult.setKeepCallback(true); + * savedCallbackContext.sendPluginResult(dataResult); */ + @Deprecated public void sendJavascript(String statement) { this.jsMessageQueue.addJavaScript(statement); }