In my scenario, my uwp app need to supports both online and offline mode. When an Event triggers and fetching data from the server, i need to serve the offline data in the mean time.
function getData()
{
// calls the server for online data
// return offline data
// return online data
}
function main()
{
var data = getData();
processData(data);
// ...
}
In this case, when the main executes, getData() need to initiates the API call and return the offline data first and the main need to proceeds by processData(offlineData). Once getData() obtains the Online Data, it need to send the value back to main again and proceed by proceeds by processData(onlineData). Kindly assist me the way to acheive this requirement.