cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/8] js commit: implement exec for firefoxos
Date Wed, 11 Sep 2013 23:30:45 GMT
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/ffos
Commit: 0bc7da8b13db556e851362443bf41122bad8c9dc
Parents: 3be32a3
Author: James Long <longster@gmail.com>
Authored: Wed Sep 11 16:34:38 2013 -0400
Committer: James Long <longster@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];
     }
 };


Mime
View raw message