06-12-2012 03:38 PM
Hi,
I'm new in WebWorks so i need some help from you guys. ![]()
I’m trying to develop application for BB OS 6, 7 and 10 and PlayBook and best solution is WebWorks.
I start with basic news reader parsing JSON from webservice and everything look great news being populated as expected then I call message details using “bb.pushScreen” detail news shown ok but when i go back (with bbUI.js) I need to repopulate everything again which slows down application.
Is there any better way of doing this.
Thanks
Vedran
06-12-2012 06:22 PM
Hello Vedran,
When you say "repopulate", do you mean that the content is being loaded back in, or do you mean that you are reconnecting to the external server and requesting the data again?
Since bbui.js loads all "screens" into the same page, the content will need to be brought back in by the framework once you switch back. However, you should be able to use the content that's already been requested / loaded. I don't think it would be necessary to reach out to the server and request new data on each screen load.
Does that make sense?
06-12-2012 06:48 PM
Hello,
Thanks for answer,
I tap on menu (back) (from bbui.js generated menu) and my content disappears from previous screen, so I need to reconnect to external server and request data again.
I’m glad to hear that and that make sense. I will try to write clean app with last build of bbui.js for just this and see if it works.
Vedran
06-13-2012 06:22 AM
Why not store the data in localStorage after the first request with an expires timestamp (5 minutes in the future maybe)?Then if your user navigates to a different screen and comes back the original one the app would check is the expires time, if it is still valid it loads the local data, if it expired then go to the remote source.
Rory
06-13-2012 06:33 AM