Coding differences

If you have previously created a BlackBerry 10 WebWorks 1.0 app, it needs only a few small coding changes to make it compatible with BlackBerry WebWorks 2.0 or later.

Include cordova.js instead of webworks.js

In BlackBerry WebWorks 1.0 apps, you needed to include webworks.js to launch the BlackBerry WebWorks application runtime. For example:
<script src="local:///chrome/webworks.js" type="text/javascript"></script> 
In BlackBerry WebWorks 2.0 ad later, you include cordova.js instead. You should replace all instances of webworks.js with cordova.js. For example:
<script src="local:///cordova.js" type="text/javascript" ></script>

Listen for the deviceready event instead of the webworksready event

In BlackBerry WebWorks 1.0 apps, your app needed to listen for the webworksready event, and could not call any BlackBerry WebWorks APIs until the event had occurred. For example:
document.addEventListener('webworksready', function(e) {
.
.
.
}
In BlackBerry WebWorks 2.0 or later, your projects need to listen for the deviceready event instead. You should replace all instances of webworksready with deviceready. For example:
document.addEventListener('deviceready', function(e) {
.
.
.
}

Last modified: 2014-10-09



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus