Enyo 2.0 Onyx Sampler Example
This example shows how to build the Enyo 2.0 sample application Onyx Sampler as a BlackBerry WebWorks application.
Enyo 2.0 is based on the Enyo 1.0 framework but is designed to be a cross platform framework for all modern mobile and desktop browsers. Since BlackBerry 6, 7.x, PlayBook 1/2.x and BlackBerry 10 all have WebKit Browsers, and allow you to package web content into full applications, it's possible to port Enyo 2.0 applications to BlackBerry relatively quickly.
The Onyx Sampler application comes with the Onyx UI extension for Enyo 2.0 and is a showcase application with Onyx UI Samples. We will use this example as our starting point to build a WebWorks application for BlackBerry. Source for this can be viewed here: https://github.com/timwindsor/EnyoJS-on-BlackBerry/tree/master/Enyo-2.0-OnyxSampler/lib/onyx/examples/OnyxSampler
Building for BlackBerry
The Onyx Sampler app refers to the enyo.js and enyo.css files in the zip, and so we can skip updating the references in this case. In general we would follow steps like this:
- Download 2.0 from EnyoJS.com
- Create an /enyo dir and put enyo.js and enyo.css there
- Update your enyo references: <link href='enyo/enyo.css' rel='stylesheet' type='text/css'> and <script src='enyo/enyo.js'></script>
- Create a /lib folder and copy in what you need (Onyx and the other frameworks in this case)
- Create a config.xml file
- Zip your package
- Run the zip through the WebWorks Packager
Creating a config.xml file
The config.xml file tells the packager the details it needs in order to build an application.
The details to set are as follows:
- Name appears on the Homescreen
- Description appears in the Application list
- Author must match Debug Token
- Add an Icon and Loading Screen image (loading screen is optional)
- Can force a single orientation if necessary
- Content points to our index.html
See our documentation on creating a config.xml file here: https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/Working_with_Config_XML_file_1866970_11.html
Zip the package
The zip file needs to follow a basic pattern: config.xml must be at the root of the zip, but other resources can be in folders. You just need to reference the content appropriately. Note how our config.xml file points into the file structure to get it's index page: <content src="/lib/onyx/examples/OnyxSampler/index.html"/>
See more documentation on the zip archive here: https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/Creating_an_archive_file_1873325_11.html
Package with WebWorks
Depending on which platforms you are targetting, there are different packagers. Each takes the same archive content and creates a different application container in the appropriate SDK. The WebWorks packagers can be downloaded here: https://bdsc.webapps.blackberry.com/html5/download/sdk
For BlackBerry Java Smartphones with OS 5, 6 or 7.x, the WebWorks packager makes a Java application. Details on packaging an application are here: https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/Compile_WW_app_for_Smartphones_1873321_11.html
For BlackBerry PlayBook tablets with OS 1.0 and 2.x, the packager creates an AIR application. Details on packaging an application are here: https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/Compile_WW_app_for_Tablets_1873322_11.html
Additional Resources on Enyo
The Enyo JS framework has a website with many resources, including links to forums, samples and documentation here: http://enyojs.com/
The main Github site is here: https://github.com/enyojs
Addiitonal Resources on BlackBerry
The BlackBerry WebWorks microsite is here: https://bdsc.webapps.blackberry.com/html5/
Forums for WebWorks development are here: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/bd-p/browser_dev
The main BlackBerry Github site is here: http://github.com/blackberry
Enyo Framework and sample is released under the Apache 2.0 License.
Packaging files for this sample are also released under the Apache 2.0 License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.