You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/12/31 04:02:33 UTC
js commit: CB-8210 android: Add message channel for events (closes
#96)
Repository: cordova-js
Updated Branches:
refs/heads/master 75a5420f3 -> 36bb1f196
CB-8210 android: Add message channel for events (closes #96)
- Initialize a message channel for native -> Javascript via the core App plugin
- Use channel to receive events from native to be fired in Javascript
- Keyboard detection events implemented via this new channel
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/36bb1f19
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/36bb1f19
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/36bb1f19
Branch: refs/heads/master
Commit: 36bb1f19619ff2bf1fe9eea474583cd53900b6f2
Parents: 75a5420
Author: Jason Chase <ja...@gmail.com>
Authored: Wed Dec 24 12:25:30 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Dec 30 22:01:59 2014 -0500
----------------------------------------------------------------------
src/android/platform.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/36bb1f19/src/android/platform.js
----------------------------------------------------------------------
diff --git a/src/android/platform.js b/src/android/platform.js
index 4d613c3..d11daba 100644
--- a/src/android/platform.js
+++ b/src/android/platform.js
@@ -59,7 +59,23 @@ module.exports = {
// Let native code know we are all done on the JS side.
// Native code will then un-hide the WebView.
channel.onCordovaReady.subscribe(function() {
+ exec(onMessageFromNative, null, 'App', 'messageChannel', []);
exec(null, null, "App", "show", []);
});
}
};
+
+function onMessageFromNative(msg) {
+ var cordova = require('cordova');
+ var action = msg.action;
+
+ switch (action)
+ {
+ case 'hidekeyboard':
+ case 'showkeyboard':
+ cordova.fireDocumentEvent(action);
+ break;
+ default:
+ throw new Error('Unknown event action ' + action);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org