You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/02/07 02:44:03 UTC

cordova-ubuntu git commit: CB-8417 moved platform specific js into platform

Repository: cordova-ubuntu
Updated Branches:
  refs/heads/master 7d547b50a -> a00fa7c47


CB-8417 moved platform specific js into platform


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

Branch: refs/heads/master
Commit: a00fa7c47b765b5ef2fb47f11d4e0d4621f49805
Parents: 7d547b5
Author: Steve Gill <st...@gmail.com>
Authored: Fri Feb 6 17:43:57 2015 -0800
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Feb 6 17:43:57 2015 -0800

----------------------------------------------------------------------
 cordova-js-src/exec.js     | 85 +++++++++++++++++++++++++++++++++++++++++
 cordova-js-src/platform.js | 33 ++++++++++++++++
 2 files changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/a00fa7c4/cordova-js-src/exec.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
new file mode 100644
index 0000000..1c3e04c
--- /dev/null
+++ b/cordova-js-src/exec.js
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 cordova = require('cordova'),
+    utils = require('cordova/utils');
+
+var callbackId = 1;
+cordova.callbacks = [];
+
+cordova.callback = function() {
+    var scId = arguments[0];
+    var callbackRef = null;
+
+    var parameters = [];
+    for (var i = 1; i < arguments.length; i++) {
+        parameters[i-1] = arguments[i];
+    }
+    callbackRef = cordova.callbacks[scId];
+
+    // Even IDs are success-, odd are error-callbacks - make sure we remove both
+    if ((scId % 2) !== 0) {
+        scId = scId - 1;
+    }
+    // Remove both the success as well as the error callback from the stack
+    delete cordova.callbacks[scId];
+    delete cordova.callbacks[scId + 1];
+
+    if (typeof callbackRef == "function") callbackRef.apply(this, parameters);
+};
+
+cordova.callbackWithoutRemove = function() {
+    var scId = arguments[0];
+    var callbackRef = null;
+
+    var parameters = [];
+    for (var i = 1; i < arguments.length; i++) {
+        parameters[i-1] = arguments[i];
+    }
+    callbackRef = cordova.callbacks[scId];
+
+    if (typeof(callbackRef) == "function") callbackRef.apply(this, parameters);
+};
+
+var _initialized = false;
+function ubuntuExec(success, fail, service, action, args) {
+    if (callbackId % 2) {
+        callbackId++;
+    }
+
+    var scId = callbackId++;
+    var ecId = callbackId++;
+    cordova.callbacks[scId] = success;
+    cordova.callbacks[ecId] = fail;
+
+    args.unshift(ecId);
+    args.unshift(scId);
+
+    if (!_initialized) {
+        _initialized = true;
+        window.oxide.addMessageHandler("EXECUTE", function (msg) {
+            eval(msg.args.code);
+        });
+    }
+
+    window.oxide.sendMessage("from-cordova", {messageType: "callPluginFunction", plugin: service, func: action, params: args});
+}
+module.exports = ubuntuExec;

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/a00fa7c4/cordova-js-src/platform.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js
new file mode 100644
index 0000000..cf792a2
--- /dev/null
+++ b/cordova-js-src/platform.js
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = {
+    id: "ubuntu",
+    bootstrap: function() {
+        var channel = require("cordova/channel"),
+            cordova = require('cordova'),
+            exec = require('cordova/exec'),
+            modulemapper = require('cordova/modulemapper');
+
+        modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy');
+        require('cordova/channel').onNativeReady.fire();
+    }
+};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org