Dave Shepherd
Posts: 0
Joined: Fri May 30, 2014 9:22 am

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

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Dave Shepherd
Posts: 0
Joined: Fri May 30, 2014 9:22 am

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

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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.

Return to “Issues”