PeterStaev / nativescript-image-swipe

A NativeScript widget to easily :point_up_2: and :mag: through a list of images
Apache License 2.0
35 stars 21 forks source link

Can I clear image cache? #55

Closed sroy93 closed 4 years ago

sroy93 commented 4 years ago

Is there a way to clear the image cache at some point in code so that if an image changes, but keeps the same url, the image-swipe component will update? Or update the image that is saved in the image cache maybe? Something to that effect..

PeterStaev commented 4 years ago

Hey @sroy93 , currently there is no built-in way, but you can just append a random query string to the URL and this will cause the image to be re-cached.

sroy93 commented 4 years ago

Oh okay. So you mean even if the URL of the image itself doesn't change, you could put "?somethingrandom=somethingrandom" at the end of the URL each time the image itself updates?

sroy93 commented 4 years ago

I'm adding "?recache=" + Math.random(); to the URL property each time the image is retaken and it is working perfectly. If you saw my message about it not working, I deleted it because I had some additional things I had to add on my end to make it work for my code, but it is working. Thanks so much!!

PeterStaev commented 4 years ago

Just a quick follow up - clearing the cache or removing a specific image from it is now available in the new version of the plugin available in the ProPlugins NPM registry.

All future work of this plugin will be available exclusively as part of ProPlugins initiative. So if you want to get the latest updates/fixes/features make sure you subscribe to the service. You get all my plugins plus many of the most used and high quality plugins for a small monthly subscription fee.

sroy93 commented 4 years ago

I do subscribe already, I just am not using that version because of Progress having issues connecting to their NPM servers and not being able to build apps via NativeScript Sidekick with them included. But, as soon as they get that solved, that is where I will go for updates. Thank you for the follow up!