cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hermw...@apache.org
Subject [1/12] webos commit: merging changes to webos platform.js
Date Tue, 05 Feb 2013 21:14:53 GMT
merging changes to webos platform.js


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

Branch: refs/heads/master
Commit: 732f9db4a1bdafefc7f368ed9c79a12ce3cdaa79
Parents: 65fa7c6
Author: Markus Leutwyler <mleut@yahoo.com>
Authored: Tue Jan 8 13:22:56 2013 +0100
Committer: hermwong <herm.wong@gmail.com>
Committed: Mon Jan 14 14:16:56 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/cordova-webos/blob/732f9db4/lib/webos/platform.js
----------------------------------------------------------------------
diff --git a/lib/webos/platform.js b/lib/webos/platform.js
new file mode 100644
index 0000000..cb0d7e5
--- /dev/null
+++ b/lib/webos/platform.js
@@ -0,0 +1,129 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var service=require('cordova/plugin/webos/service'),
+    cordova = require('cordova');
+
+module.exports = {
+    id: "webos",
+    initialize: function() {
+        if (window.PalmSystem) {
+            window.PalmSystem.stageReady();
+        }
+
+        var Mojo = window.Mojo || {};
+
+        // wait for deviceready before listening and firing document events
+        document.addEventListener("deviceready", function () {
+
+            // LunaSysMgr calls this when the windows is maximized or opened.
+            window.Mojo.stageActivated = function() {
+                console.log("stageActivated");
+                cordova.fireDocumentEvent("resume");
+            };
+            // LunaSysMgr calls this when the windows is minimized or closed.
+            window.Mojo.stageDeactivated = function() {
+                console.log("stageDeactivated");
+                cordova.fireDocumentEvent("pause");
+            };
+            // LunaSysMgr calls this when a KeepAlive app's window is hidden
+            window.Mojo.hide = function() {
+                console.log("hide");
+            };
+            // LunaSysMgr calls this when a KeepAlive app's window is shown
+            window.Mojo.show = function() {
+                console.log("show");
+            };
+
+            // LunaSysMgr calls this whenever an app is "launched;"
+            window.Mojo.relaunch = function() {
+                // need to return true to tell sysmgr the relaunch succeeded.
+                // otherwise, it'll try to focus the app, which will focus the first
+                // opened window of an app with multiple windows.
+
+                var lp=JSON.parse(PalmSystem.launchParams) || {};
+
+                if (lp['palm-command'] && lp['palm-command'] == 'open-app-menu')
{
+                    console.log("event:ToggleAppMenu");
+                    cordova.fireDocumentEvent("menubutton");
+                }
+                
+                console.log("relaunch");
+                return true;
+            };
+
+            // start to listen for network connection changes
+            service.Request('palm://com.palm.connectionmanager', {
+                method: 'getstatus',
+                parameters: { subscribe: true },
+                onSuccess: function (result) {
+                    console.log("subscribe:result:"+JSON.stringify(result));
+
+                    if (!result.isInternetConnectionAvailable) {
+                        if (navigator.onLine) {
+                            console.log("Firing event:offline");
+                            cordova.fireDocumentEvent("offline");
+                        }
+                    } else {
+                        console.log("Firing event:online");
+                        cordova.fireDocumentEvent("online");
+                    }
+                },
+                onFailure: function(e) {
+                    console.error("subscribe:error");
+                }
+            });
+
+        });
+    },
+    clobbers: {
+        requestFileSystem:{
+            path: 'cordova/plugin/webos/requestfilesystem'
+        },
+        FileReader: {
+            path: "cordova/plugin/webos/filereader"
+        }
+    },
+    merges: {
+        navigator: {
+            children: {
+                service: {
+                    path: "cordova/plugin/webos/service"
+                },
+                application: {
+                    path: "cordova/plugin/webos/application"
+                },
+                window: {
+                    path: "cordova/plugin/webos/window"
+                },
+                notification: {
+                    path: "cordova/plugin/webos/notification"
+                },
+                orientation: {
+                    path: "cordova/plugin/webos/orientation"
+                },
+                keyboard: {
+                    path: "cordova/plugin/webos/keyboard"
+                }
+            }
+        }
+    }
+};


Mime
View raw message