Page 1 of 1

Slow loading of initial request of an Azure Mobile Service - Splash Screen

Posted: Tue Jun 03, 2014 1:18 pm
by Dave Shepherd

Hi
I wander if anyone could assist or point me in the right direction.

During the loading of my startScreen I invoke a service that retrieves data from a Windows Azure Mobile Service. The initial load,of the service, is slow - approx 5 to 10 seconds. After that any other call to a WAMS REST service with in that session is pretty quick and I happy with that. Its just the first one that is slow. Purpose of service is to retrieve a collection of names and popolute a list on the startScreen,

What I was thinking is this.
Create a Splash Screen as the startup screen.
Invoke the service and navigate to the "2nd" screen once the service returns a response.
Somehow populate a localstorage variable (array) with the response and pass it to the 2nd screen to populate the list.

Is that possible?

Thanks
Dave


Slow loading of initial request of an Azure Mobile Service - Splash Screen

Posted: Tue Jun 03, 2014 3:12 pm
by Kateryna Grynko

Hi Dave,

Yes, you can do it.

Add service Success event handler to save service response in localStorage. Use a variable 'data' to access service response.


Slow loading of initial request of an Azure Mobile Service - Splash Screen

Posted: Fri Jun 06, 2014 10:33 am
by Dave Shepherd

Hi Katya.

I have managed to, upon "Success " save the response to a localStorage variable and the navigate to Page 2.

The LSV now contains the JSON representation of the service response consisting of say 10 items.

I am having a problem now, wanting to iterate through that the JSON response in the LSV and populate the list. ListItems contain 2 lables. One for Description and the other for the ID (Not visible)

Please assist

Thanks
Dave


Slow loading of initial request of an Azure Mobile Service - Splash Screen

Posted: Fri Jun 06, 2014 2:14 pm
by Evgene Karachevtsev

Hello Dave,

You can create javascript object from localStorage variable that contains JSON represantation:

codevar v = JSON.parse(localStorage.getItem('name')); /code

If your response was array you will be able iterate on it.