incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject docs commit: updating bada guide for plugin development
Date Tue, 17 Jul 2012 22:00:29 GMT
Updated Branches:
  refs/heads/master 8d46caf4f -> c31e6cbb5


updating bada guide for plugin development


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

Branch: refs/heads/master
Commit: c31e6cbb5a80e778d81bd9e76e29acef931b9308
Parents: 8d46caf
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Tue Jul 17 15:00:17 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Tue Jul 17 15:00:17 2012 -0700

----------------------------------------------------------------------
 .../en/edge/guide/plugin-development/bada/index.md |   53 +++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/c31e6cbb/docs/en/edge/guide/plugin-development/bada/index.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/plugin-development/bada/index.md b/docs/en/edge/guide/plugin-development/bada/index.md
index b79dc5b..258bb23 100644
--- a/docs/en/edge/guide/plugin-development/bada/index.md
+++ b/docs/en/edge/guide/plugin-development/bada/index.md
@@ -19,3 +19,56 @@ license: Licensed to the Apache Software Foundation (ASF) under one
 
 Developing a Plugin on Bada
 ===========================
+
+Plugins are only supported on Bada 2.0 and above. Bada 1.2 does not support plugins.
+
+The Bada implementation is a full javascript implementation. Therefore, adding a custom plugin
involves updating CordovaJS with your plugin code. Follow these steps to add a simple _Hello
World_ plugin:
+
+1. Clone the CordovaJS repository
+
+        git clone https://git-wip-us.apache.org/repos/asf/incubuator-cordova-js.git
+
+2. Create a new javascript file under __lib/bada/plugin/bada/__ and name it _HelloWorld.js_.
Add the following content:
+
+        function HelloWorld() {
+        }
+
+        HelloWorld.prototype.printHello = function(success, fail, arg) {
+            alert(Osp.Core.StringHelper('Hello %1', arg[0]));
+        }
+
+        module.exports = new HelloWorld();
+
+3. Add a link to your newly created plugin in __lib/bada/platform.js__ under the objects
property:
+    
+        objects: {
+            ...
+            HelloWorld: {
+                'cordova/plugin/bada/HelloWorld' 
+            },
+            ...
+        }
+        ...
+4. Update the plugin list under __lib/bada/exec.js__ to include your plugin
+
+        var plugins = {
+            ...
+            "HelloWorld": require('cordova/plugin/bada/HelloWorld')
+        };
+5. Now you can write your user-facing javascript however you like but remember that in order
for your plugin to execute you need to call the following method
+
+        exec(succes, fail, 'HelloWorld', 'printHello', ['Jackson!']);
+
+    success is the success callback that gets executed when the plugin succeeds
+    fail is the failure callback that gets executed if the plugin fails
+    'HelloWorld' is the name of your plugin
+    'printHello' is your plugin action
+    Finally, the last argument is your plugin parameters (if any).
+
+6. Run the following command to generate the new common javascript (make sure you have the
jake npm module installed)
+
+        jake
+
+7. Copy the newly generated javascript under __pkg/cordova.bada.js__ to your Bada project
under __Res/js__
+
+6. That is it! You can now add new Bada plugins and implement the many features that are
not currently supported by Cordova Bada.


Mime
View raw message