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/09/13 01:40:07 UTC

[4/9] js commit: implement exec for firefoxos

implement exec for firefoxos


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

Branch: refs/heads/master
Commit: 0bc7da8b13db556e851362443bf41122bad8c9dc
Parents: 3be32a3
Author: James Long <lo...@gmail.com>
Authored: Wed Sep 11 16:34:38 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Wed Sep 11 16:34:50 2013 -0400

----------------------------------------------------------------------
 lib/firefoxos/exec.js     | 11 ++++++++---
 lib/firefoxos/platform.js | 13 +++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
index ab3311b..d9d958a 100644
--- a/lib/firefoxos/exec.js
+++ b/lib/firefoxos/exec.js
@@ -1,3 +1,8 @@
-module.exports = function() {
-    console.log('exec not implemented yet');
-}
+var firefoxos = require('cordova/platform');
+
+module.exports = function(success, fail, service, action, actionArgs) {
+    var plugin = firefoxos.getPlugin(service);
+    actionArgs.unshift(fail);
+    actionArgs.unshift(success);
+    plugin[action].apply(plugin, actionArgs);
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index 4903014..b7158d8 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -19,9 +19,22 @@
  *
 */
 
+var plugins = {};
+
 module.exports = {
     id: 'firefoxos',
+    cordovaVersion: '3.0.0',
+
     bootstrap: function() {
         require('cordova/channel').onNativeReady.fire();
+    },
+
+    registerPlugin: function(name, plugin) {
+        plugins[name] = plugin;
+        console.log('registered ' + name);
+    },
+
+    getPlugin: function(name) {
+        return plugins[name];
     }
 };