Skip to content

Commit

Permalink
Small refactor to injection of webworks.js
Browse files Browse the repository at this point in the history
- changed to document.head
- added error handler and alert if things go south
  • Loading branch information
gtanner committed Dec 14, 2012
1 parent 877fec1 commit d8204cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/scripts/bootstrap-blackberry.js
Expand Up @@ -20,18 +20,19 @@
*/

document.addEventListener("DOMContentLoaded", function () {
var wwjs;
switch(require('cordova/platform').runtime()) {
case 'qnx':
wwjs = document.createElement("script");
wwjs.type = "text/javascript";
var wwjs = document.createElement("script");
wwjs.src = "local:///chrome/webworks.js";
wwjs.onload = function () {
document.addEventListener("webworksready", function () {
require('cordova/channel').onNativeReady.fire();
});
};
document.getElementsByTagName("head")[0].appendChild(wwjs);
wwjs.onerror = function () {
alert('there was a problem loading webworks.js');
};
document.head.appendChild(wwjs);
break;
case 'air':
require('cordova/channel').onNativeReady.fire();
Expand Down

0 comments on commit d8204cc

Please sign in to comment.