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 2013/12/06 21:59:19 UTC
[1/2] js commit: fixed licensed headers for ubuntu
Updated Branches:
refs/heads/master 286dff281 -> 17d33054b
fixed licensed headers for ubuntu
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/17d33054
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/17d33054
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/17d33054
Branch: refs/heads/master
Commit: 17d33054b78e3b90a7a663937c67478910074381
Parents: ba8fb5a
Author: Steven Gill <st...@gmail.com>
Authored: Fri Dec 6 12:57:46 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Fri Dec 6 12:59:14 2013 -0800
----------------------------------------------------------------------
lib/ubuntu/exec.js | 13 ++++++++-----
lib/ubuntu/platform.js | 13 +++++++------
2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/17d33054/lib/ubuntu/exec.js
----------------------------------------------------------------------
diff --git a/lib/ubuntu/exec.js b/lib/ubuntu/exec.js
index b9a107f..e6e476d 100644
--- a/lib/ubuntu/exec.js
+++ b/lib/ubuntu/exec.js
@@ -1,10 +1,12 @@
/*
*
- * Copyright 2013 Canonical Ltd.
- *
- * Licensed 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
+ * 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
*
@@ -16,6 +18,7 @@
* under the License.
*
*/
+
var cordova = require('cordova'),
utils = require('cordova/utils');
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/17d33054/lib/ubuntu/platform.js
----------------------------------------------------------------------
diff --git a/lib/ubuntu/platform.js b/lib/ubuntu/platform.js
index 4b2ac03..3871545 100644
--- a/lib/ubuntu/platform.js
+++ b/lib/ubuntu/platform.js
@@ -1,10 +1,11 @@
/*
- *
- * Copyright 2013 Canonical Ltd.
- *
- * Licensed 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
+ * 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
*
[2/2] js commit: add ubuntu platform
Posted by st...@apache.org.
add ubuntu platform
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/ba8fb5a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/ba8fb5a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/ba8fb5a6
Branch: refs/heads/master
Commit: ba8fb5a6fcfde11d1b9ff5f686396c89b1f0626c
Parents: 286dff2
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Fri Nov 22 19:48:44 2013 +0400
Committer: Steven Gill <st...@gmail.com>
Committed: Fri Dec 6 12:59:14 2013 -0800
----------------------------------------------------------------------
Gruntfile.js | 3 +-
lib/ubuntu/exec.js | 74 +++++++++++++++++++++++++++++++++++++++++++++
lib/ubuntu/platform.js | 30 ++++++++++++++++++
3 files changed, 106 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ba8fb5a6/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 02de1d2..3fb4d32 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -33,7 +33,8 @@ module.exports = function(grunt) {
"test": {},
"windows8": { useWindowsLineEndings: true },
"windowsphone": { useWindowsLineEndings: true },
- "firefoxos": {}
+ "firefoxos": {},
+ "ubuntu": {}
},
clean: ['pkg'],
jshint: {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ba8fb5a6/lib/ubuntu/exec.js
----------------------------------------------------------------------
diff --git a/lib/ubuntu/exec.js b/lib/ubuntu/exec.js
new file mode 100644
index 0000000..b9a107f
--- /dev/null
+++ b/lib/ubuntu/exec.js
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed 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);
+};
+
+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);
+
+ navigator.qt.postMessage(JSON.stringify({messageType: "callPluginFunction", plugin: service, func: action, params: args}));
+}
+module.exports = ubuntuExec;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ba8fb5a6/lib/ubuntu/platform.js
----------------------------------------------------------------------
diff --git a/lib/ubuntu/platform.js b/lib/ubuntu/platform.js
new file mode 100644
index 0000000..4b2ac03
--- /dev/null
+++ b/lib/ubuntu/platform.js
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed 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();
+ }
+};