Plugins for Cordova

README.md

#BlackBerry 10 Cordova Plugins This repo contains plugins for Apache Cordova that expose functionality of the BlackBerry 10 platform.

##Using Cordova BlackBerry Plugins ###Prerequisites

  1. Install WebWorks

###Adding project plugins

  1. cd project
  2. webworks plugin add plugin_name

###Updating project plugins To update a plugin, run:

  1. webworks plugin remove plugin_name
  2. webworks plugin add plugin_name

###Using custom built plugins

  1. webworks plugin add plugin_name --searchpath path_to_custom_plugin_directory

##Maintaining / Creating Plugins ###Build Prerequisites

  1. Install node and npm and add to path
  2. Install BlackBerry Native SDK if you need to build JNEXT extensions
  3. [Windows] Add git.exe to PATH, i.e. Git Installation Directory\bin
  4. Install [jake] globally (npm install --global jake)
  5. Install [jshint] globally (npm install --global jshint)

###Setup and Build

  1. git clone https://github.com/blackberry/cordova-blackberry-plugins/
  2. cd cordova-blackberry-plugins
  3. git fetch origin
  4. git checkout master
  5. npm install to install dependencies
  6. Setup bbndk environment variables: (must be done within each session, prior to jake)
    • [Mac/Linux] source BBNDK installation directory/bbndk-env.sh
    • [Windows] BBNDK installation directory\bbndk-env.bat
  7. jake build - check that there are no errors

###Running Tests

  1. jake test - to run js tests using nodejs
  2. jake hint - to run jshint on the JavaScript source
  3. jake - default is to build, run tests and jshint

Note: To see a full list of commands available with jake, use jake -T.

###Dependencies

  1. cpplint is used for linting C++ code. Source code is located under dependencies/cpplint
  2. JNEXT 1.0.8.3 is used to build extensions Original source of JNEXT Modifications are available in source code and located under dependencies/jnext_1_0_8_3

Authors

General Architecture

  • client.js – The extension's public API
  • index.js – Loaded by Cordova and only accessible across the cordova.exec bridge
  • manifest.json – Metadata for the extension
  • native – Contains all the native code for the JNEXT extension
  • test
    • integration – test app spec using Jasmine browser tests
    • unit – unit tests using jasmine. Keeps the same folder structure as the code

How to build an extension?

Extensions are all under the plugin/ folder. An extension must at least contain the following:

  • manifest.json – metadata for the extension
  • client.js – Front facing API, this is injected into the App's content
  • index.js – Controller loads this part of the API

If your extension requires native C/C++ code, a native JNEXT extension is needed. There is a sample and there are detailed docs.

Contributing

To contribute code to this repository you must be signed up as an official contributor.

  1. Fork the cordova-blackberry-plugins repository
  2. Make the changes/additions to your fork
  3. Send a pull request from your fork back to the cordova-blackberry-plugins repository
  4. If you made changes to code which you own, mention a committer listed below to have your code merged using @user notation.

Committers

Other related Repos