What do I need to do to adjust the way this method returns to only return the value and not the Promise?:
function getCacheValue(toMatch){
return caches.open("v1.1::Custom").then(cache=>{ cache.match(toMatch).then(result=>result).then(resultValue=>resultValue);});
}
Essentially what I would like it to return is the Response from case.match(). I'm still pretty new to asynchronous Promises, Everything I've tried ends up returning a Promise rather than the result of the Promise. I've also tried wrapping the caches.open call in a new Promise((res, rej){caches.open.....}) and calling res(resultValue) and also tried Promise.resolve(...) but I still can't seem to just get resultValue to return.
I'm pretty sure the issue here is the synchronous function is trying to get the result of an asynchronous call but I am fairly certain that should still be possible to accomplish.
Also, I would prefer the getCacheValue function to remain synchronous as I will end up synchronously sending different values into it if the result is null from the first call.