Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 4
Registered: ‎07-10-2013
My Device: Z10
My Carrier: Blackberry
Accepted Solution

Problem with webworks.js

Ripple's console is always telling me that he can't found webworks.js, although webworks is there.

 

My code is:

 


<script type="text/javascript" src="local:///chrome/webworks.js"></script>


 

Retired
Posts: 64
Registered: ‎06-04-2012
My Device: Blackberry Z10
My Carrier: Bell

Re: Problem with webworks.js

When executing your app on the actual device, this line is needed to reference the webworks.js file located on the device. In the Ripple Emulator, this error can be ignored since it does not require this file, BUT it must be included in your code in order for your WebWorks app to call the BlackBerry APIs once your app is loaded on a device.

----------------------------------------------------------------------------------
- Did this post help solve the issue? Click on "Accept as Solution"
- Was the content of this post helpful? Please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Problem with webworks.js

A nice clear answer that tells you nothing

 

Basically Ripple loads twice - this is where the error occurs

 

After load #1 it presumably mounts a VFS so it can access webworks.js then reloads itself (I can only summise how I'd do it)

 

If you look at some of the examples you'll see a hack to test for ripple

 

You need something like this...

 

document.addEventListener('webworksready', function(e) {
	// This is a hack for Ripple calling webworksready multiple times
	if (rippleLoaded) return;
	rippleLoaded = true;

	});

 

You need to set rippleLoaded to false in your main JS before this can possibly be called

 

This fixes everything

 

[Moan time]

 

BBs documentation on stuff like this is REALLY bad - you think that was hard, try doing HTML5 filesystem (not fun)

 

 

 

 




Click the like button if you find my posts useful!
New Contributor
Posts: 4
Registered: ‎07-10-2013
My Device: Z10
My Carrier: Blackberry

Re: Problem with webworks.js

Thanks a lot!