cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsoref <...@git.apache.org>
Subject [GitHub] cordova-plugin-globalization pull request: BB10 implementation
Date Wed, 30 Jul 2014 18:34:27 GMT
Github user jsoref commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-globalization/pull/18#discussion_r15603094
  
    --- Diff: src/blackberry10/native/readme.txt ---
    @@ -0,0 +1,406 @@
    +Template for BlackBerry 10 Cordova Plugins
    +==========================================
    +
    +BlackBerry 10 Cordova Plugins create a bridge between JavaScript code in an HTML5 application
and C/C++ and/or Qt code in the plugin, allowing access to native libraries, which are not
part of the HTML5 specification. The BlackBerry 10 Plugins included with the Cordova SDK also
follow the same or similar format as shown in this template.
    +
    +Plugins offer a JavaScript API which communicates through an interface to native methods.
This interface can send and receive data through strings, or data that can be represented
as a string such as JSON and Base64.
    +
    +This template includes examples for communicating in several ways:
    +
    +1. A function that returns a string from a native method.
    +2. A function that sends a string to, and gets another back, from a native method.
    +3. A function that calls a native method with a JSON object input, and provides a callback
function, which is fired by a native method, and receives JSON data.
    +4. Defining a property that is linked to native methods when retrieved or set.
    +5. Starting and Stopping a native thread, with a callback function that receives events
from the native thread.
    +
    +## Building and Testing the Sample
    +
    +The included sample is the default Cordova Hello World application created by the "cordova
create" command. It is ready to run on your simulator simply by calling "cordova run" in the
sample directory. It has been altered to include a div in "index.html" for displaying the
test data, and a set of test functions in "js/index.js" to excercise the template API and
display some results.
    +
    +To use the plugin in another project, that's been created with Cordova, run "cordova
plugin add <path to this Template folder>/plugin"
    +
    +Then you can call the methods with the namespace "community.templateplugin", and that
should appear in WebInspector as an Object so you can see what APIs are available. The example
APIs included will be detailed later in this guide.
    +
    +## Starting a Plugin from the Template
    +
    +Copy the Template folder to a location on your computer to start working with it.
    +
    +### Momentics NDK setup
    +
    +You can either import the project from the Template folder, or use the New Project Wizard
in Momentics to create a starter project.
    +
    +#### Using the New Project Wizard
    +
    +1. Open the Momentics IDE. Navigate to the workbench and from the program menu select
File -> New -> New BlackBerry Project.
    +2. Choose Native Extension from the Project Type list, then select BlackBerry WebWorks,
and click Next.
    +3. Change the project name to "Template" and click Finish.
    +4. Right click your project again and select Build Configurations -> Manage..., then
click New.
    +5. Enter "device" for the name and choose to copy settings from Device-Release.
    +6. Repeat to create a configuration named "simulator", and choose to copy settings from
Simulator-Debug.
    +7. You will need to copy the device and simulator folders to the "/plugin/src/blackberry10/native"
directory where you copied the Template, each time you build. You can configure a post build
command if you'd like, in the project properties.
    +
    +#### Importing the Template
    +
    +1. Open the Momentics IDE. Navigate to the workbench and from the program menu
    +select File -> Import and choose "Existing Projects into Workspace".
    +2. Choose "Select root directory: " and browse to the "/plugin/src/blackberry10/native"
directory where you copied the Template. Select the Template project in the Projects list
and uncheck "Copy projects into workspace". Click Finish.
    +3. Follow these next steps to build the template plugin to be sure the setup is working.
    +
    +#### How to build your native Plugin
    +
    +1. Right click your project and select the Clean Project option.
    +2. Right click your project again and select Build Configurations -> Build Selected...
.
    +3. A window will appear that shows all the available build configurations
    +for the project. Select "device" and "simulator" and click ok.
    +4. You should see the shared libraries (libTemplate.so files) generated in the folders
for each Build Configuration that you selected.
    +
    +### Using the Plugin in an Application
    +
    +To use the plugin in another project, that's been created with Cordova, run "cordova
plugin add <path to this Template folder>/plugin".
    +That will copy the plugin into the project, and update the www/config.xml file to include
the feature as below:
    +
    +
    +<feature name="community.templateplugin" value="community.templateplugin" />
    +
    +
    +All the methods in the plugin will be prefixed by that feature name, so a method called
"test()" supplied in the "community.templateplugin" plugin will be called in JavaScript like
so:
    +
    +
    +community.templateplugin.test();
    +
    +
    +Depending on the plugin, these methods can also have return values, take arguments, or
supply callback methods.
    +
    +To remove the plugin, run "cordova plugin rm community.templateplugin"
    +
    +### Modifying the Template Plugin
    +
    +#### Namespace
    +Choose a namespace for your application that is concise and descriptive. Use community.pluginname
as the general format. Change all the occurences of the name in plugin/plugin.xml. Update
the "ID variable in client.js to match the namespace.
    --- End diff --
    
    sp: occurences 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message