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
Developer
asiayeah
Posts: 118
Registered: ‎11-05-2011
My Device: Z10, Bold 9900
My Carrier: Smartone
Accepted Solution

Different behavior with webworksreadyevent in OS 10.2.0.341

I am testing my existing WebWorks app on OS 10.2.0.341 and find an issue. When 'webworksready' event is fired, I find that DOM isn't ready yet and hence document.body returns null. Previously in 10.0 and 10.1, DOM is already ready. I am using BlackBerry 10 WebWorks SDK 1.0.4.11.

 

I could workaround it by registering webworksready event when DOM is already ready, but I'd like to know if this is an unexpected change. Or perhaps a new WebWorks SDK may "fix" it?

 

Does it happen to your apps, too?

 

Thanks.

 

 

Please use plain text.
Developer
peardox
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: Different behavior with webworksreadyevent in OS 10.2.0.341

Can I suggest you try the following?

 

Write an event handler then call it as part of body

 

In the event handler fire a loaded request to another handler

 

Finally trap the webworksready and call your init script

 

I use this sequence af things all the time and it is highly effective (you can even adapt it to Cordova + do Latent loads)

 

I must admit that getting to the solution was rather hard - the effect, however is a robust system I  can reply on




Click the like button if you find my posts useful!
Please use plain text.
Developer
asiayeah
Posts: 118
Registered: ‎11-05-2011
My Device: Z10, Bold 9900
My Carrier: Smartone

Re: Different behavior with webworksreadyevent in OS 10.2.0.341

Thanks. I figured the workaround for my app by registering webworksready event only when DOM is ready.

 

I am more thinking if it is an expected change in 10.2 or not. Quite a few WebWorks apps in BB World may got broken due to this change.

 

If it is an expected change (perhaps some apps don't need DOM ready and webworksready together), it may worth to be documented somewhere.

Please use plain text.
BlackBerry Development Advisor (Retired)
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Different behavior with webworksreadyevent in OS 10.2.0.341

That's good feedback, thanks for sharing.

 

It is true that the DOMReady and webworksready events are independant.  There is no guarantee that one will happen before the other unless you manage the workflow via event handling.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.