Editor’s note: below is a blog post from Bryan Higgins from the WebWorks team. @bryanhiggins on Twitter
As a member of the WebWorks team at BlackBerry, I’m proud to announce that all of our BB10 APIs have been released as Apache Cordova plugins. Developers using Adobe PhoneGap or other Apache Cordova distributions will now have access to the full set of APIs that we ship as part of the WebWorks SDK.
Cordova Plugin Registry
The plugins are available through the recently launched Cordova Plugin Registry. This central database of plugins is accessible via the command line interface for developers running version 3.1 or higher.
To install a plugin, simply use the “plugin add” command with the plugin’s id (see the chart below for a full list):
cordova plugin add com.blackberry.bbm.platform
This will fetch the plugin from the registry and install it into the app. It may also modify the config.xml file under platforms/blackberry10 to include permissions required for the plugin to function correctly.
All of the plugins we released are listed in the chart below. The API column links to the relevant WebWorks docs. The permissions column lists any app permissions automatically added when the plugin is installed.
Moving From WebWorks to Apache Cordova
In the process of converting the WebWorks extensions to Apache Cordova plugins, two significant changes were introduced to make the APIs work well with the rest of the Apache Cordova ecosystem. If you’re a WebWorks developer moving to Apache Cordova, you’ll want to make note of these:
- There is no need to add feature elements to config.xml. The WebWorks SDK relied on feature elements to include APIs at package time. Apache Cordova applications install plugins using command line tools before they are built.
- Events are raised on document rather than blackberry.event. The core Apache plugins raise events on document. We have chosen to follow this convention. Use document.addEventListener rather than blackberry.event.addEventListener.
Follow Us On GitHub
The WebWorks team is committed to working in the open. All of our plugins are licensed under Apache 2 and full source code is available on our GitHub repository. Feedback and contributions are always welcome!