cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hermw...@apache.org
Subject [2/12] webos commit: Added support for the back-gesture (mapped to backbutton)
Date Tue, 05 Feb 2013 21:14:53 GMT
Added support for the back-gesture (mapped to backbutton)


Project: http://git-wip-us.apache.org/repos/asf/cordova-webos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-webos/commit/03581552
Tree: http://git-wip-us.apache.org/repos/asf/cordova-webos/tree/03581552
Diff: http://git-wip-us.apache.org/repos/asf/cordova-webos/diff/03581552

Branch: refs/heads/master
Commit: 0358155229366f191a46452ba32e97c323e6fa23
Parents: 732f9db
Author: Markus Leutwyler <mleut@yahoo.com>
Authored: Tue Jan 8 13:28:59 2013 +0100
Committer: hermwong <herm.wong@gmail.com>
Committed: Mon Jan 14 15:15:36 2013 -0800

----------------------------------------------------------------------
 lib/webos/platform.js |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-webos/blob/03581552/lib/webos/platform.js
----------------------------------------------------------------------
diff --git a/lib/webos/platform.js b/lib/webos/platform.js
index cb0d7e5..9f297ed 100644
--- a/lib/webos/platform.js
+++ b/lib/webos/platform.js
@@ -65,11 +65,21 @@ module.exports = {
                     console.log("event:ToggleAppMenu");
                     cordova.fireDocumentEvent("menubutton");
                 }
-                
+
                 console.log("relaunch");
                 return true;
             };
 
+            // start listening for keyup events to catch the back-gesture
+            document.addEventListener('keyup', function(ev) {
+              if (ev.keyIdentifier == "U+1200001" || ev.keyIdentifier == "U+001B" || ev.keyIdentifier
=="Back") {
+                console.log("Firing event:backbutton");
+                cordova.fireDocumentEvent("backbutton");
+                ev.preventDefault();
+                return true;
+              }
+            }, false);  
+
             // start to listen for network connection changes
             service.Request('palm://com.palm.connectionmanager', {
                 method: 'getstatus',


Mime
View raw message