I'm trying to add a sort of page cache for an activity stream where if it has called and stored it in localStorage recently then load that using a dedicated echo service mappped to the page otherwise load it from the REST api and then store it in localStorage, however the echo override does not seem to be working.
here is the code I have on pageshow for the activity page
var cache = localStorage.getItem('cache_activities');
if(cache!=null){
console.log('loading cache');
//echo_activities.requestOptions.echo = JSON.stringify(cache);
echo_activities.requestOptions.echo = cache;
echo_activities.execute({});
}else{
console.log('executing service');
activity_user_service.execute({});
}
when it loads from cache I get a parsererror
I can add a resonse to the services default echo but that doesnt help since we want to retrieve it from storage